Skip to content

Instantly share code, notes, and snippets.

@Integralist
Last active May 28, 2025 17:23
Show Gist options
  • Save Integralist/510068111c4e2ac933c8d7a3710e732e to your computer and use it in GitHub Desktop.
Save Integralist/510068111c4e2ac933c8d7a3710e732e to your computer and use it in GitHub Desktop.
Git: Revision Range #git #revision #range

Reference: https://git-scm.com/book/en/v2/Git-Tools-Revision-Selection

Log commits in feature branch that aren't in master:

git log master..feature

If you git pull your master branch you might find there are additional commits from your colleagues. So you might want to check what commits were recently merged into master that aren't in your feature branch:

git log feature..master

The triple dot range will show you all the git commits that aren't common to both branches.

Imagine we have a master branch with the commits A, B. We create the feature branch and add C, D commits. Then we go back to master and add E, F commits. In this scenario both branches have A, B commits, but diverge from there. The following log example will report C, D, E, F because these commits aren't common to both branches:

git log master...feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment