Wednesday 25 April 2012

Git merging

Usually one wants to merge a branch back into the master (or "trunk" equivalent branch).
To do so simply used:
git checkout master (for instance)

followed by
git merge BRANCH_NAME


Bare in mind this means you explicitly are not attempting to hide the fact you have branched and that the branch will be committed to the remote repository if you git svn dcommit.

You can then remove the merged branch using
git -d BRANCH_NAME


This gives a tree structure similar to this:
   /----------------\ <- BRANCH_NAME
------------------------------------- <- *master

where / represents the branch out and the \ represents the merge back into the master branch.

This is not very elegant unless you want to share remote branches, if you are just working with your branch locally (as you would be if you are using git over SVN), then rebase is probably the nicer option (see coming post). Thoughts?

No comments:

Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory