Saturday, December 13, 2008

git: pushing to update remote branch refs

These past days I've been working on my hobby project xbps (xtraeme's build package system), which will be a package manager for GNU/Linux (not ready yet!). I'm handling the repository with the git VCS (Version Control System) because it gives me just what I want: performance, disconnected mode, etc, etc; also creating branches is cheap, you should be using them!

Back to the point that I was thinking for this post... I wanted to commit some experimental changes to test them before merging into master and I created a new branch; tested the changes, merged them into the master branch again, removed the now unused experimental branch and pushed the changes to the remote repo. After pushing the changes, the remote repo still showed up that the branch that I had just removed was still there... why's that?

Of course the answer was that you have to update the refs in remote, otherwise it doesn't know what changes you did locally! in short, to push your branch in remote repo:

$ git push origin branch

and to remove your local and remote branch (once merged into master or other branch):

$ git push origin :branch

Knowing this surely will help me in the future! I have still to learn a lot about it.

No comments: