To check our commit history on a Repository within Git, we use the git log
command. When using this command we scroll through the commit log within our Terminal by hitting the Enter
key, and then we need to hit q
on our keyboard to exit reading the git log.
This post is to demo the --online
parameter that can be added to the git log statement. Adding this parameter to the git log command will return a condensed commit log history so its easier for us to read it.
Git Log Oneline Examples
Adding –oneline to the git log command condenses the commit log history output.
# Show git log in one line git log --oneline
Show a Set Number of Commits
We can pass in a line number parameter for it to return a specific number of commits.
# show most recent 2 commits git log -2 # show most recent 5 commits on one line git log -5 --oneline
More Git Tips
For more info on the git log command, check out my other posts:
– Git Log Command Examples
– Git Log (Author) Command Example
Or click the Git tag below for other git tips!
Leave a Reply