Exercise - Branching (advanced)

Info

  • git branch

Tips

  • git switch -c <name> creates a new branch and activates it immediately.
  • git branch -vv shows details about the local branches
  • git switch <name> switches the active branch
  • git merge <branch> integrates the changes from branch and creates a commit on the active branch.

Initial situation

Step 0 - START

$ cd repo


Step 1 - Create branch

Start in directory git-uebungen/aufgaben/<unknown>.

Create a branch feature-a, edit the file foo and create a commit. Then switch back to main and edit bar there. Show the commit graph.

Step 2 - Merge branch

Start in directory git-uebungen/aufgaben/<unknown>.

Merge feature-a into main and show the commit graph.

Step 3 - ⭐ Analyze merge

Start in directory git-uebungen/aufgaben/<unknown>.

Show which commits from main were added in the merge. Show which commits from feature-a were added in the merge. Also show the changes (diffs) for both sides.

Step 4 - ⭐ Analyze merge

Start in directory git-uebungen/aufgaben/<unknown>.

Show which commits from main were added in the merge. Show which commits from feature-a were added in the merge. Also show the changes (diffs) for both sides.

Step 5 - Examine remote branches

Start in directory git-uebungen/aufgaben/<unknown>.

repo $ cd ..


To the solution

To the overview