4

I am working in a branch (fork of master of course) and I have a series of commits.
I am interested in finding out exactly which commit is the one that is is where the branch started and is part of the master.

Why do I need this?
I want to squash all the commits with interactive rebase and I was wondering if there is an easy way to figure out what to pass to rebase command instead of manually counting commits to pass HEAD~52

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Jim
  • 18,826
  • 34
  • 135
  • 254

1 Answers1

3

git merge-base accepts two commits (which, as usual can be commit-hashes, branches, tags, etc) and returns the common ancestor they both diverged from.

E.g.:

mureinik@comupter ~/src/git/myproject [master] $ git merge-base master feature-1
7c2232a4dd6c54ee8cc3f693ab8a0020ad82410b
Mureinik
  • 297,002
  • 52
  • 306
  • 350