Is it possible git log to be auto refreshed after commit or can I use another utillity in the Terminal to see list of all previous commits which auto refreshes itself?
The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA)
`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.
We can limit the git log output by including the -<n> option. This enables us to specify how many log messages are printed in the terminal. We can add the --oneline flag to show each commit on one line.
I prefer the following, because it's cleaner than the other solution:
watch git log -2
Much easier to type
If you want to refresh each 5 seconds, instead of 2 seconds, use
watch -n 5 git log -2
For those without watch
function/binary:
function watch()
{
local delay=2
local lines=$(tput lines)
lines=$((${lines:-25} - 1))
if [[ "$1" -eq "-n" ]]; then
shift
delay=$((${1:-2}))
shift
fi
while true
do
clear
"$@" | head -n $lines
sleep $delay
done
}
You mean something like this?
while true; do clear; git log -2 | cat; sleep 5; done
This shows the top two git log entries, refreshing every 5 seconds. The "| cat" is there to avoid git opening a pager.
This does not get new remote changes, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With