0

Is it possible to determine whether a commit (or md5hash value) is a "merge" from a developer branch to a parent branch? (i.e. master)

Thanks in advance.

John Wick
  • 703
  • 10
  • 22
  • You can check from the git command , here is the so link that has the command https://stackoverflow.com/questions/3824050/telling-if-a-git-commit-is-a-merge-revert-commit – Rajeev Bera Nov 17 '22 at 16:10

2 Answers2

2

Sure, just check how many parents it has:

git show --pretty=%ph --quiet some-brach-or-commit

If more than one parent shows up, it's a merge commit.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • Thanks! So here is a problem, I think our repo has squash commits. I just checked one of our 'merge' commits and it only has one parent.... not sure why. (Developer branch getting merged to Master) – John Wick Nov 17 '22 at 16:13
  • 1
    It is probably because it was a _squash_ merge.... and then you are out of luck because _to git_, that's not a real merge because there is no relation to the _other_ branch that was merged. – eftshift0 Nov 17 '22 at 16:16
  • thanks @eftshift0 , that's what I feared :( – John Wick Nov 17 '22 at 16:24
0

You can use ether UI or git log on master that will show you a list of all the commits made to a repository and search for your commit

  • Thanks for the info. I was actually trying to ask if there was a way we can determine a commit is a 'merge' type commit :( – John Wick Nov 17 '22 at 16:07