Say you want to move a lot of levels up in the commit tree. It might be tedious to type ^ several times, so Git also has the tilde (~) operator.
Command Description
^ Move upwards one commit at a time
~n Move upwards a number of times.


The tilde operator (optionally) takes in a trailing number that specifies the number of parents you would like to ascend. Let's see it in action.

Before moving

Git before checkout HEAD


Let's specify a number of commits back with ~.

git checkout HEAD~4

After moving

Git after checkout HEAD


Boom! So concise -- relative refs are great.

You're an expert on relative refs now, so let's actually use them for something. You can directly reassign a branch to a commit with the -f option. So something like:

git branch -f master HEAD~3

moves (by force) the master branch to three parents behind HEAD.

Before branch --force

Git before force branch


git branch -f master HEAD~3

After branch --force

Git after force branch


There we go! Relative refs gave us a concise way to refer to C1 and branch forcing (-f) gave us a way to quickly move a branch to that location.

Now that you have seen relative refs and branch forcing in combination, let's use them to solve the challenge.