Sikau

Git & GitHub · Day 8 · about 25 min

Merging

Bring a finished branch back into main.

Done? Bring it home.

The contact page is finished on its branch. A merge combines that branch's commits into the branch you're on.

Two kinds of merge

git switch -c contact
echo "<h1>Contact</h1>" > contact.html
git add .
git commit -m "Add contact page"
git switch main
git merge contact
git log --oneline
git branch -d contact
git switch -c gallery
echo "<h1>Gallery</h1>" > gallery.html
git add .
git commit -m "Add gallery"
git switch main
echo "<footer>Open daily</footer>" > footer.html
git add .
git commit -m "Add footer"
git merge gallery
git log --oneline --graph

The rest of this lesson

  • Fast-forward or merge commit?explain
  • The merge routineexplain
  • Fast-forward?predict
  • Will it fast-forward?predict
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 18 lessons of Git & GitHub