Important note
git
uses double score --
as flag marker.
- Use standard push and pull to avoid mistake.
Command
Standard push & pull
git push <origin> <local-branch>:<remote-branch>
git pull <origin> <remote-branch>
Remote
git remote add <new> <remote-repo>
git remote -v
git remote set-url <origin> <new-ssh/http>
Branch
git clone --single-branch --branch <remote-branch> <remote-repo>
git push <origin> <local-branch>:<new-remote-branch>
git branch -d <local-branch>
git branch -d <local-branch>
git push <origin> --delete <remote-branch>
- Create a local branch to catch up with remote branch
git checkout --track -b <new-local-branch> <origin>/<remote-branch>
- Prune remote branches to sync
git remote prune <origin>
Allow unrelated history
git pull <origin> <remote-branch> --allow-unrelated-histories