Ask Steves · Daily notes · VPS, 20% off · AI Profit Lab · SEO · Money Hub

9 November 2026 · One command a day

How do I see recent git commits in one line each on Linux?

When something on your server changed and you want to know what, the commit history is the first place to look. git log --oneline -20 prints the last 20 commits in a repository, one line each, so the whole recent story fits on one screen. Use it when you log in after a deploy, after a teammate pushed, or when a site starts behaving differently.

I learn my automation tips in the AI Profit Boardroom. Have a look here. Affiliate link.

The command

cd /var/www/appname
git log --oneline -20

git log lists commits on the current branch, newest first. --oneline squeezes each commit to a short hash and the first line of its message. It is shorthand for --pretty=oneline --abbrev-commit. -20 limits the list to 20 commits and is the same as -n 20 or --max-count=20. Change the number to see more or fewer. If you would rather not cd first, git -C /var/www/appname log --oneline -20 does the same thing from anywhere.

What you will see

a3f9c21 (HEAD -> main, origin/main) Fix redirect from www to example.com
7b2e4d0 Add rate limit to contact form
1c8e93f Bump Node packages
e45a7b2 Move API keys out of config into .env
9d02f6a (tag: v1.4.0) Release 1.4.0
58bb1e3 Cache static assets for 7 days
...

The first column is the short commit hash. You can paste it into other git commands. The names in brackets show where things point. HEAD -> main is the commit you are on now, origin/main is where the remote branch was at your last fetch, and tags mark releases. The rest of the line is the commit message, so the history is only as useful as the messages people wrote.

When to use it

Watch out for

If you run git as root inside a folder owned by another user, git may refuse with fatal: detected dubious ownership in repository. This is a safety check, not a broken repo. The clean fix is to run git as the owner, for example sudo -u appuser git log --oneline -20, or to open a shell as that user. Adding the folder with git config --global --add safe.directory also works, but it switches the check off for that path for good.

Questions people ask

How do I see the history of one file only?

Put the path after a double dash: git log --oneline -20 -- path/to/file. Only commits that touched that file are listed.

How do I see what a single commit changed?

Copy its hash and run git show a3f9c21. That prints the full message, the author, the date and the diff.

Reading the real history of the code your sites run on, right where it runs, is the kind of thing you can only do on a server you control. You can get the same VPS with 20% off at https://asksteves.co.uk/vps. Affiliate link.

Want more automation tips? The AI Profit Boardroom on Skool is where I get mine. Have a look here. Affiliate link.

Everything on this blog runs on one Hostinger KVM 8. This link takes 20% off the same box.

GET A VPS, 20% OFF →

Affiliate link.

Related server notes: How do I see systemd timers on Linux? · How do I see exactly which lines changed in my files with git diff? · How do I see what has changed in a git repository before I commit? · All daily notes