Chapter 5. Advanced branching

 

This chapter covers

  • Configuring git merge’s behavior
  • Resolving merge conflicts
  • Avoiding having to solve the same merge conflicts multiple times
  • Creating a tag
  • Generating a version number from previous tags
  • Bringing individual commits from one branch to another
  • Reverting a previous commit
  • Listing what branches contain a given commit

When working as part of a team on a software project, you’ll typically use branches to separate work between individuals, features, bug fixes, and software releases. You should already be able to perform some basic branching actions, such as creating, deleting, and merging a branch. This chapter will expand on those so you can improve your branching workflow to be more effective. Let’s start by learning how to use some of the parameters provided by git merge.

Technique 33 Merging branches and always creating a merge commit

You learned in technique 14 how to perform a basic merge of two branches by using git merge branchname, where branchname is the name of the branch you wish to merge into the current branch.

Recall that a merge commit is one that has multiple parents and is displayed in GitX by the convergence of two or more branch tracks. git merge provides various options for merging branches without creating merge commits, using various strategies or resolving conflicts with a graphical merge tool.

5.1. Merge strategies

5.2. Using a graphical merge tool

5.3. Summary