git
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| git [2013/07/01 19:49] – [Backup] k2patel | git [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ==== Setting up GIT ==== | ==== Setting up GIT ==== | ||
| + | === Create Server === | ||
| + | == Define User == | ||
| + | <code bash> | ||
| + | git config --global user.name " | ||
| + | git config --global user.email " | ||
| + | </ | ||
| + | |||
| + | == Create location for Repository == | ||
| + | <note tip> | ||
| + | <code bash> | ||
| + | mkdir -p / | ||
| + | cd / | ||
| + | </ | ||
| + | |||
| + | == Create bare repository == | ||
| + | <code bash> | ||
| + | git --bare init | ||
| + | </ | ||
| + | |||
| + | === Initial Synchronize with client === | ||
| + | == Initializing commit == | ||
| + | <note tip> | ||
| + | <code bash> | ||
| + | cd / | ||
| + | git init | ||
| + | git add . | ||
| + | git commit -m " | ||
| + | </ | ||
| + | |||
| + | == Define server and push files == | ||
| + | **For Local** | ||
| + | <code bash> | ||
| + | git remote add origin / | ||
| + | git push origin master | ||
| + | </ | ||
| + | |||
| + | **For Remote** | ||
| + | <code bash> | ||
| + | git remote add origin ketan@reposerver:/ | ||
| + | git push origin master | ||
| + | </ | ||
| ==== Backup ==== | ==== Backup ==== | ||
| Line 69: | Line 110: | ||
| done | done | ||
| </ | </ | ||
| + | |||
| + | ==== Git reset local ==== | ||
| + | **following command can be used for following purpose :** \\ | ||
| + | To discard all local changes and restore it to the remote repository.\\ | ||
| + | When you have error //Your branch is ahead of ' | ||
| + | <code bash> | ||
| + | git reset --hard origin/ | ||
| + | git pull | ||
| + | </ | ||
| + | |||
| + | ===== Git Submodule ===== | ||
| + | |||
| + | ==== Clone Repository including submodule ==== | ||
| + | |||
| + | <code bash> | ||
| + | git clone --recursive git@github.com: | ||
| + | </ | ||
| + | |||
| + | ==== clone submodule from existing project ==== | ||
| + | |||
| + | <code bash> | ||
| + | git submodule update --init --recursive | ||
| + | </ | ||
| + | |||
| + | ==== To initialize single submodule ==== | ||
| + | <code bash> | ||
| + | git submodule update --init modules/ | ||
| + | </ | ||
| + | |||
| + | ==== Pull changes from all submodule ==== | ||
| + | <code bash> | ||
| + | git submodule foreach git pull origin master | ||
| + | </ | ||
| + | |||
| + | ==== Usefull when submodule HEAD and status HEAD messed up ==== | ||
| + | <code bash> | ||
| + | git submodule update --init | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
git.1372708155.txt.gz · Last modified: 2020/08/10 02:30 (external edit)
