In this tutorial I will show you how to view the history of the project. You could use the
git log command to get a list of what changes have been made in the repository. Execute the command:
And see the following output.
It list all the commits you have made to the repository so far. You can control how exactly the history is displayed. The one line format is:
git log --pretty=oneline
And the output would be similar to:
Controlling What is Displayed
There are a lot of options for selecting what is displayed in the log.
git log --pretty=oneline --max-count=2 git log --pretty=oneline --since='10 minutes ago' git log --pretty=oneline --until='10 minutes ago' git log --pretty=oneline --author=<your name> git log --pretty=oneline --all
See man git-log for all the details.
Popular Log Format
One of the popular log formats is:
git log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
It outputs the log in the following format.
Lets take a look at all the options we have used.
--pretty="..."defines the format of the output.
%his the abbreviated hash of the commit
%dare any decorations on that commit (e.g. branch heads or tags)
%adis the author date
%sis the comment
%anis the author name
--graphinforms git to display the commit tree in an ASCII graph layout
--date=shortkeeps the date format nice and short
This content has been helpful to you?
Thanks for contributing!