Git
Set upstream:
git push --set-upstream remote_name local_branchgit pull --set-upstream remote_name local_branch
Delete branch:
git branch -d xxxgit branch -D xxx(force delete)git push MY_REMOTE --delete XXXgit push MY_REMOTE :XXX(identical to above)
Move branch:
git checkout OLD_NAMEgit branch -m NEW_NAME
Active branch in a bare repository:
- see
repo/HEAD(and change it if needed)
Create a new branch and switch to it:
git checkout -b BRANCH
Merge unrelated repositories:
git pull ../other/ master --allow-unrelated-histories --no-rebase
Submodules
At start:
git clone XXX --recurse-submodules
At new one:
- git submodule add https://github.com/... path
./is allowed,.is not but only on remote paths, not local paths../other-prj.gitis also allowed
Manually:
- git submodule init
- git submodule update (--recursive)
Or in one command:
- git submodule update --init (--recursive)
If problems:
- git submodule deinit (--all)
If head detached:
git branch -u <origin>/<branch> <branch>git checkout -b <branch> --track <origin>/<branch>
The git submodule sync will update your config file with the details from the .gitmodules file, so the latter should be considered the 'master'.