kevin Abel wrote:Should I make a new thread for each question next time?
That's not necessary. Let's just keep the discussion in this thread.
git checkout bugFix -It moves the asterisk * to bugFix so it becomes the tip, HEAD? git has focus here. I'm not exacly sure what the * means.
The asterisk just means that
HEAD is currently pointing at the indicated branch. So what is
HEAD exactly?
HEAD is just a pointer that indicates which branch or commit you are currently working with. All operations you perform are done relative to the commit that is currently checked out. If you
git checkout a specific branch or commit, it does two things:
Move HEAD to indicate which branch or commit you are currently working with.Load the version of your source code that was recorded in the checked out commit.
If you've checked out a specific branch, the tutorial will not display
HEAD and instead just indicate the checked-out branch with an asterisk.
If instead,
HEAD is pointing at a commit directly, it will not display an asterisk but it will display
HEAD as a separate label. We call this situation "Detached
HEAD". This is a situation that has its uses, but they are pretty advanced and in real life, you will almost always want to have
HEAD point to a branch instead (the situation where the HEAD label isn't displayed, but instead the checked-out branch is displaying an asterisk).
I need some clues please.
In this assignment, you can see that you don't need to create any commits or rebase or merge anything: The commit tree that you start with already contains all the commits that the goal also contains. That means that the only thing you need to do is move the branch and HEAD pointers around.
Again, let's solve one thing at a time. The order isn't important, but let's focus on
HEAD first.
HEAD is pointing at commit
C2, but it needs to point at commit
C1, which is the direct parent of commit
C2.
Here are the ingredients:
To move the HEAD pointer, you need to use the git checkout command.To reference the parent of a commit, you can use the ^ or ~ operators.
Next, let's move
bugFix to commit
C0, which is the direct parent of the commit that
HEAD is now pointing at. The ingredients:
To move a branch pointer, you can use the git branch command with the -f switch.To reference the parent of a commit, you can use the ^ or ~ operators.
Finally, we need to move
main to commit
C6.
C6 is greyed out because it is not part of any branch. To be part of a branch, a commit needs to be pointed at by a branch pointer, or it needs to be the ancestor of such a commit. In a way, a commit that is not part of a branch is "unreachable": We can not use the
~ or
^ operators to reach it from a branch pointer. Instead, we need to reference the commit directly by using the commit hash. The ingredients:
To move a branch pointer, you can use the git branch command with the -f switch.To reference an "unreachable" commit, you need to use the commit hash directly. In this case, the commit hash is C6.
Write down all the commands that you used to solve this assignment. Write down what you tried to achieve by calling the command. I can review your thought process, and let you know whether you've made any mistakes.