brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: git log main..feature lists the commits that are not on main yet

Git
~/tips/tip-git-log-two-dot-range

git log --oneline main..feature

Shows exactly which commits a merge would bring in from your branch.

Before I merge or push, I like to see which commits are actually new. A two-dot range in git log gives that list.

git log --oneline main..feature

Read main..feature as “reachable from feature, but not from main”. Commits that are already on main don’t show up, so you get only what a merge would add. Turn it around and you see what main got since you branched:

git log --oneline feature..main

It works with remote branches too. After a git fetch, git log HEAD..origin/main shows what you’d get from a pull, and git log origin/main..HEAD shows what you haven’t pushed yet. Leave out one side and git fills in HEAD, so git log origin/main.. means the same as the last one.

The list compares commits, not content. If someone cherry-picked one of your commits onto main, it has a different hash there, and the range still lists your copy. git cherry is the tool that spots those. Also remember to fetch first: the range only knows about origin/main as it was at your last fetch.

Further reading: gitrevisions documentation, git-log documentation

More Git tips git show-branch main feature git log --stat -5 git merge --no-ff feature -m "Merge feature" git merge --squash feature git merge --abort All Git tips (144) All topics

Link