Fast-forward merge
As mentioned previously, there are two types of merges.
Fast-fowrad merge takes place when a branch is simply ahead of another branch. In this case, there's no conflict, as the longer branch includes the shorter one completely. What Git will do is to update shorter branch to the latest commit.
In a non-fast-forward merge, it may cause an conflict.
Scenario 1: both branches edit the same file, one says the patient ID is 8, the other says 10. This is a conflict and you need to step in to tell Git which one to use.
Scenario 2: both branches edit the same file, but different sections of a file. One changes paitent ID to 8 and the other changes the learning rate to 1e-3. In this case, no conflict occurs and Git can handle this.
This section will look at the fast-forward merge.
In the previous example, new
is simply ahead of master
. If we want to include the changes back to master
, it will be a fast-forward merge.
We first change back to master
and perform the merge using git merge <branch-name>
.
Now the commit history shows master
is pointing to the lastest commit.
Last updated