Git Tutorial: Branching and Merging

45
One of the most compelling features of the Git version control system (VCS) is its ability to create highly usable and lightweight branches, and the ease of merging those branches later. Branching creates multiple “copies” of the same repository and allows you to separate out a set of changes while you experiment with them, or to create different versions of a project, without affecting the main tree. It’s a feature that developers sometimes don’t make the most of, simply because branching is so much more costly in other VCSes that they’re not used to it, or they’re not aware of the many branch commands and tricks available in Git. Here’s a host of useful tips to get your Git branching and merging skills up to expert level in no time.

Since it’s so quick and easy to branch in Git, and equally easy to merge back into the main tree, it’s worth branching whenever you’re working on something new. It’s also good practice to use a branch when reviewing someone else’s patches before merging them with your own master branch.

Read more at Wazi