Using Git History, Aliases, and Tags
In this lab, you'll work through some simple examples of using the git log command to see the flexibility it offers, and also create an alias to help simplify using it. You'll also look at how to tag commits to have another way to reference them.
This lab assumes that you have done Connected Lab 3: Tracking Content through the File Status Life Cycle. You should start out in the same directory as that lab.
- Starting in the same directory that you used for Connected Lab 3, begin by making another change to the repository to make the history more interesting. Add a line to the first file you committed into the repository and then stage and commit. Note that you can use the following shortcut:
$ echo new >> file1.c $ git commit -am "add a line"
- Look at the history you have so far in your small repository. To do this, run the log command. (In some terminals, your history may be longer than the screen and so you will need to press a key to continue. If you are paging through the log output on a Unix terminal and want to end the listing, press the q key.)
$ git log $ git status –s
- Often when looking at Git history information, users only want to see the first line of each entry, the subject line. This is why it is important to make that first line meaningful when using Git. (Note that I do not do that in this book.)
To see only the first line of each log message, you can use the --oneline option. Try it now. ...