When both branches have new commits, main's label can't slide forward. Git compares three snapshots: the two branch tips and their merge base, the last commit they share. It combines the changes from both sides into a new merge commit.
git log --oneline --graph --all
* c236045 (HEAD -> main) Cache pages
| * d2c2f44 (feature/faq) Add the FAQ
|/
* d5b73e2 Start the shop ← the merge basegit merge opens the merge commit's message in the editor panel, with a message already written. Save it as it is, or edit it:
git merge feature/faq
hint: Waiting for your editor to close the file...Merge branch 'feature/faq'
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.Merge made by the 'ort' strategy.
faq.html | 1 +
1 file changed, 1 insertion(+)
create mode 100644 faq.html
git log --oneline --graph --all
* 5d7df55 (HEAD -> main) Merge branch 'feature/faq' ← the merge commit
|\
| * d2c2f44 (feature/faq) Add the FAQ
* | c236045 Cache pages
|/
* d5b73e2 Start the shopA merge commit has two parents, one per branch it joined. git merge --no-edit <branch> takes git's message without opening the editor.
Objectives
- Find the merge base.
- Merge the gift cards into
main. - Find the merge commit.