Hoon H.
https://help.github.com/articles/pushing-to-a-remote
git push <REMOTENAME> <BRANCHNAME>
git push <REMOTENAME> <LOCALBRANCHNAME>:<REMOTEBRANCHNAME>
git reset # This unstage all uncommited changes, but they still remain in working tree.
git checkout . # This reloads all files from latest commit into working tree.
git fetch origin
git reset --hard origin/master
git pull --recurse-submodules
git submodule update --recursive
This fetches submodules of currently linked revision, and does NOT UPDATE REVISION
linkage to a newer version. This is a feature for the situation that you git clone
a new
repository because it doesn't bring the linked submodules automatically. (except
you set some explicit parameters...)
If you want to update the submodule linkage, you need to git pull
on each submodule directory and commit on master repository.
Reference: http://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules#answer-8084186
This is THE ONLY WORKING way. Do not try clone command.
-
Move to desired directory.
-
git submodule add <url>
-
Do this for all submodules you want.
If the added submodule has another submodules, it won't be downloaded automatically. Then, run this to make it downloaded.
-
git submodule update --init --recursive
-
Commit at this point.
git add . -A git commit -a
Source: http://stackoverflow.com/questions/1535524/git-submodule-inside-of-a-submodule-nested-submodules
Move to the root directory of the submodule. And,
git pull
You're done.
git submodule foreach git pull
git submodule foreach git pull origin master # If the submodule does not have a default upstream...
This effectlvely updates submodule linkages to newer versions. Anyway, this does not commit, so you should add/commit from the master repository to persist the revision link update. Otherwise changes will remain only in working tree, and the working tree will remain as dirty.
Reference: http://stackoverflow.com/questions/1030169/easy-way-pull-latest-of-all-submodules#answer-1032653
-
Move to a container directory of a submodule that you want to delete.
-
git submodule deinit <path-to-submodule-without-trailing-slash>
-
git rm -r <path-to-submodule-without-trailing-slash>
Second command will also erase files in working tree.
-
Move to repository root.
-
rm -r .git/modules/<path-to-submodule-from-repo-root-without-trailing-slash>
Then now you can commit changes.
-
git add . -A; git commit -a
- Cited from an answer by VonC.
You need to erase them all and re-establish them all again. http://stackoverflow.com/questions/19508849/how-to-fix-broken-submodule-config-in-git
This entry shows the best way.
# in proj2:
git remote add proj1 path/to/proj1
git fetch proj1
git merge proj1/master # or whichever branch you want to merge
Note that;
- You have to add a remote name. It doesn't work direct remote path.
- You must
fetch
. Repository will be corrupted without fetching. - Repositories are merged at root level. Move mergee files into desired subdirectory before merging.
This is far better solution than git subtree
merge. Works very well.
Just follow this procedure. Very precise, correct and simple.