Posts Tagged ‘branch’

Git : moving a remote branch

Tuesday, December 29th, 2009

One can’t actually move a remote branch, but you can copy a branch and delete a branch, so…

Copy oldbranch in repo to newbranch.

git push {repo} {oldbranch}:heads/{newbranch}

Ex: git push origin foobranch:barbranch
renames foobranch to barbranch

Remove a remote branch: it’s all about the colon:

git push <remote_repo> :heads/<branch>

Example: git push origin :heads/some-branch removes some-branch from the remote repo (apparently git push origin :some-branch works as well).

This works for removing a tag as well: git push origin :sometag