Merging Code and Pull Requests

Learn how merging and pull requests work with Git.

We'll cover the following

Merging code

The practice of copying changes from one branch and putting the changes into another branch is called merging. Merging is a process of copying code that’s in one branch into another branch.

Once you create a branch and begin working from that branch, the code in the branch slowly becomes out of sync with the original code it came from. When you attempt to merge branch code into another branch, you will sometimes come across merge conflicts. Merge conflicts occur when Git cannot figure out how to combine the two branches.

Merge conflicts are the bane of every developer’s existence, and it is the primary reason to make branch lifetime as short as possible. The less code that needs to merge, the easier it is for Git to figure out how to combine!

Get hands-on with 1200+ tech skills courses.