« back

You Should Really Branch Out a Bit-Part 3

24 Sep 2012

Handling Conflicts, Deleting, and Renaming

Conflicts: Let's say that you have a file in your master branch. You also have that same file in another branch. You edit it in both places. Well, when you try to merge those two things together, it confused git. Git throws it's hands up in the air and wants you to fix it first. For simple merges, you can merge the files by hand. If it is a complex merge, you may want to use a visual tool.

Deleting Branches: After merging your changes into the current branch, you should delete it to avoid having unused branches lying around and accumulating. You can do this by passing -d to the command. It looks like this...

1     $> git  branch -d name_of_the_branch_you_want_to_delete
2     

Renaming: Sometimes the name of your branch needs to change along the way. To do this, you can use the -m parameter to do this. The name you choose must be unique. This is what we did in part 1. Let's see an example.

1     $> git  branch -m name_of_the_branch_you_want_to_rename new_name_of_the_branch
2     

comments powered by Disqus