Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created September 16, 2020 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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