Skip to content

Instantly share code, notes, and snippets.

@bonyiii
Created January 2, 2011 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bonyiii/762824 to your computer and use it in GitHub Desktop.
Save bonyiii/762824 to your computer and use it in GitHub Desktop.
git create remote tracking branch from local branch
1;
git branch BranchName
git push origin BranchName
git -d BranchName
git branch --track BranchName origin/BranchName
# or
2; Backup all local branches to server
git config remote.backup.mirror true
git push --all backup
# or for only one branch as the first optio:
git branch backup-branch
git push origin backup-branch
# most elegant way:
git branch --set-upstream backup-branch origin/backup-branch
# or this:
# git branch -f backup-branch origin/backup-branch
# or this:
# git config branch.backup-branch.remote origin
# git config branch.backup-branch.merge refs/heads/backup-branch
# Original can be found here: http://stackoverflow.com/questions/3565674/git-remote-branch-tracking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment