2

A while back a change was committed and I need to know when it was released to production.

We have two branches, master and production. I have found the commit SHA with command git log --all

How can I know what branch this was committed to, and if it was committed to master, when was it merged into production?

I've tried git log -v --graph <branch> for each branch, they just show the same info with identical timestamp.

It was 4 months ago, so git reflog show --all | grep <SHA> no longer shows what I need.

Thanks

namrorrim
  • 21
  • 3

2 Answers2

1

It seems to me what you can do is first list all the commits that changed the file you are tracking. For this, you can read this question.

When you are positive you know the culprit, you can find out that branches commit like this. It can even help you detect the merges which included them.

I am not sure which workflow you are using, but I hope this helps.

Happy coding!

  • Thank-you. I tried the `git reflog show --all | grep ` command on a recent commit and saw the reference to the commit. For the older commit (4 months ago) there was nothing shown, perhaps the history has been purged. The guy that set it up/looks after it is away for a few weeks so will try to add more details then. – namrorrim Aug 19 '22 at 03:36
  • @namrorrim: *Reflog* entries expire, but in general you don't want to use reflog entries for this in the first place. – torek Aug 19 '22 at 13:08
0

Finally found what I wanted. From these commands, with our setup, I can see when a commit was made, also when it was pushed and merged. Unfortunately it isn't showing the info for my commit from 4 months ago.

git reflog show --date=local master | grep <SHA>
git reflog show --date=local origin/master | grep <SHA>
git reflog show --date=local production | grep <SHA>
git reflog show --date=local origin/production | grep <SHA>

Output:

67bf7064 master@{Fri Aug 26 13:33:03 2022}: commit: Implement foobar feature
67bf7064 refs/remotes/origin/master@{Fri Aug 26 13:33:08 2022}: update by push
67bf7064 production@{Fri Aug 26 13:33:33 2022}: merge master: Fast-forward
67bf7064 refs/remotes/origin/production@{Fri Aug 26 13:33:38 2022}: update by push

Credit goes to this post.

namrorrim
  • 21
  • 3