This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
git [2013/07/01 20:02] k2patel [Setting up GIT] |
git [2016/06/08 15:37] k2patel [Git reset local] |
||
---|---|---|---|
Line 110: | Line 110: | ||
done | done | ||
</code> | </code> | ||
+ | |||
+ | ==== 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 'origin/master'// | ||
+ | <code bash> | ||
+ | git reset --hard origin/master | ||
+ | git pull | ||
+ | </code> | ||
+ | |||
+ | ===== Git Submodule ===== | ||
+ | |||
+ | ==== Clone Repository including submodule ==== | ||
+ | |||
+ | <code bash> | ||
+ | git clone --recursive git@github.com:k2patel/repo.git | ||
+ | </code> | ||
+ | |||
+ | ==== clone submodule from existing project ==== | ||
+ | |||
+ | <code bash> | ||
+ | git submodule update --init --recursive | ||
+ | </code> | ||
+ | |||
+ | ==== To initialize single submodule ==== | ||
+ | <code bash> | ||
+ | git submodule update --init modules/repo | ||
+ | </code> | ||
+ | |||
+ | ==== Pull changes from all submodule ==== | ||
+ | <code bash> | ||
+ | git submodule foreach git pull origin master | ||
+ | </code> | ||
+ | |||
+ | ==== Usefull when submodule HEAD and status HEAD messed up ==== | ||
+ | <code bash> | ||
+ | git submodule update --init | ||
+ | </code> | ||
+ | |||
+ | |||
+ |