After basic snapshotting of a repository, following commands are used to get it’s commit history.
- git log
- git shortlog
- git diff
Now, we will discuss each command and its different available options.
git log: As the name suggests, this command shows commit logs. It is a command which allows you to view information about the previous commit. Unlike git status command, it only inspects the history of committed repository.
- git log –all or git log: This command displays all commits.
- git log -n “limit”: This option helps to filter the commit history by applying the limit. Replacing “limit” with a number of commits will limit output as n most recently committed ones.
- log –author=”name”: This option limit the output to commits by particular author “name”.
- git log –committer=”name”: This option limit result to commits that were committed by that individual.
- git log -p: This option shows the most detailed view of history. Here p stands for patch.
- git log –oneline: This option is used to get bare information in a single line per commit.
- git log –stat: This option helps to view the summary of changes made in each commit.
- git log “file”: This option display commits that include specified file.
- git log –before(or –after) “date”: This limits the commits to those within a given date range. The date is specified as string in “yyyy-mm-dd” format.
- git log –after “date” –before “date”: This option specifies a date range.
git shortlog: This command is “Sub-command” of git log as it summaries git log output. Each commit is grouped by author and title.
- git log -n
–numbered: It display the output according to number of commits per author.
- git log -s
–summary: This option suppresses commit description
- git log -e
–email: This option displays the email address of each author.
- git log -c
–committer:m This option shows committer identities instead of authors.
- git log “revision range”: Displays commits in specified revision range.
git diff: This command is used to compare different versions of the file or in other words, it shows the changes between the commits, working tree, branches, files, etc.
Summarizing: We learned that a git log command is a basic tool that is used to go through the history of commits. git log is a running record of commits. git shortlog is just a subcommand of git log- summarizing the output of git log. We have just described git diff command as it one of the most advanced options of git.
- Digital Evidence - How to use FTK for examining evidence
- How to install, configure and use GIT on ubuntu?
- GIT | An Introduction to Github
- How to use GIT in Ubuntu ? (Part -2)
- An Ultimate Guide to Git and Github
- Introduction and Installation of Git
- Git- Setting up a Repository
- Saving a file in Git
- Overturning Changes In Git
- Git- Debugging
- Git - Changing History
- Introduction to Git Branch
- Git-Checkout And Merge
- What is a GIT Repository?
- Git Features
- Merge Strategies in Git
- Getting changes from a Git Repository
- Using Tags in Git
- Patch Operation in Git
- What is Git-Ignore and How to Use it?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.