Tagging Your Homework

Let's say that you did everything required for a particular git-based exercise, you committed your work (i.e., you saved your work into git) and THEN you realize that you used the wrong commit message.  This page will walk you through figuring out how to tag the correct commit with the message that you should have used as your commit message.

For more information about tagging in git you might look at the Tagging chapter in the Pro Git book (available online for free)

First, make sure that you have SourceTree open, and that you're looking at the 'master' branch under the 'BRANCHES' list in the left-hand column (under the '1', in the image below)
Tagging in SourceTree

Next, right-click on the commit that you want to tag. In our case let's just say that we want to tag the commit with the commit message "Added a single line to change the file." in the above image.  We need to right-click on that commit (the '2' arrow points to where you should click), and then select 'Tag...' from the drop-down menu that appears (under the '3' arrow). 

At this point you should see something like the following:

Tagging in SourceTree: Tag... dialog box

The first thing you should do is copy the tag name from the web page and paste it into the 'Tag Name' box (under the '1' in the above picture).

It's interesting to notice that SourceTree will fill in the specific commit for you (under the '2')

You should check off the 'push tag' box so that this will be pushed to the server (above the '3')

Lastly, you should click the 'Add Tag' button (under the '4')

Once you're done you should be able to see the tag in SourceTree.  You can do that by clicking on the '>' next to the word TAGS in the left-hand panel so that it opens up and turns into a down arrow (under the '1' in the following picture).

Viewing Tags in SourceTree

If you click on the 'WORK_FOR_EXERCISE_3-B' (or whatever your tag is called) then SourceTree will highlight it for you in the 'branches' view (near the '2' in the above picture).

Finally, you should see a note added next to the commit in the 'branches' view itself (above the '3')