Skip to main content
Junior

Merging Branches in Git

Junior

Task

Create two diverging lines of development and combine them using merge.

Steps

  1. Create the bugFix branch and switch to it.
  2. Make one commit in bugFix.
  3. Go back to main and make another commit there.
  4. While on main, merge the bugFix branch into it.

Expected result

The bugFix branch must stay on its own commit, and main must end with a merge commit that has two parents. HEAD must be on main.

What you will learn

After completing the task, you will be able to:

  • create independent changes in two branches;
  • merge branches;
  • recognize a merge commit by its two parents.
Goal
localC0C1C2bugFixC3C4HEAD main
Git trainer0 commands
terminal
localC0C1HEAD main