This is easy to do, but I always forget how to do it, so this is more a reminder to myself than anything else.
To create and checkout a branch in git :
> git branch version_0.9.3 > git checkout version_0.9.3
… or if you have a better memory than me you can do it in one command :
> git checkout -b version_0.9.3
Now we’ve created the branch, committed a bunch of changes, and we want to push it to a remote repository. Regular git push doesn’t do anything :
> git push Everything up-to-date
You have to specify the remote name where you want to push it to (usually origin, depending how you’ve configured things) :
> git push origin version_0.9.3 Total 0 (delta 0), reused 0 (delta 0) To firstname.lastname@example.org:my_repository.git * [new branch] version_0.9.3 -> version_0.9.3
The syntax to delete a remote branch is the part I always forget :
git push origin :version_0.9.3
Note that this will only delete the remote branch - you’ll still need to delete the branch locally :
> git branch -d version_0.9.3.
If you’re familiar with ruby, you should also checkout the git_remote_branch rubygem , which is designed to make working with remote branches easier.