There's more...

Although most branching scenarios expect you to completely merge branches, there are situations when, while working in a real environment, you only need to merge specific pieces of one branch into another branch. Using the --no-commit option, Git will make the merge and stop before committing, allowing you to modify and add files to the merge commit before committing.

For example, we have been working with projects where versions of strings have been updated in the feature branch but not in the master branch. So, an automatic merge into master would replace the current version string used on the master branch, which, in this case, was not the intention. In the following example, we will use a simple Git repository with a few ...

Get Git Version Control Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.