Skip to content

Instantly share code, notes, and snippets.

@aemkei
Created April 27, 2009 10:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aemkei/102432 to your computer and use it in GitHub Desktop.
Save aemkei/102432 to your computer and use it in GitHub Desktop.
push existing local branch to remote
#syntax
git checkout -b name_of_local_branch
#example
git checkout -b experimental
#syntax
git push my_repo name_of_local_branch:refs/heads/name_of_remote_branch
#example
git push origin experimental:refs/heads/experimental
# syntax
mate .git/config
[branch "name_of_local_branch"]
remote = my_repo
merge = refs/heads/name_of_remote_branch
#example
mate .git/config
[branch "experimental"]
remote = origin
merge = refs/heads/experimental
# syntax
git fetch
git checkout --track -b name_of_local_branch origin/name_of_remote_branch
# example
git fetch
git checkout --track -b experimental origin/experimental
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment