0

How can I find the latest squashed commit?

Clarification: I mean a commit created by the command

git merge --squash branch

Ideally I'd like to know how I can find the second-to-last merge or squash commit, but if I get an answer to my primary question, I can probably figure out the rest.

Klas Mellbourn
  • 42,571
  • 24
  • 140
  • 158

1 Answers1

3

Technically there is no way to tell if a commit is squashed or not. When you rebase and squash commits, you are just making a new commit with those changes and there is no difference (as far as git is concerned) to just having done the changes and made a new commit.

Now if in your workflow you adjust the commit message to identify that the commit was squashed, you can use this answer to search through the log and find the commit that was squashed.

Schleis
  • 41,516
  • 7
  • 68
  • 87