3

I'd like to get the ID for the last push received (not git rev-parse HEAD).

For example, if I do git diff-tree --name-status master it will show me all changes since the last push, but I want to see changes at a specific push.

trusktr
  • 44,284
  • 53
  • 191
  • 263

1 Answers1

4

If you are talking about the last push that you (ie your repo) received from a given remote, for a given branch (like, for instance, master):

 git rev-parse origin/master

(this blog post illustrates it by listing changes since last push:
git log origin/master.. --stat

The command is also used in the question "git erroneously states I'm ahead of origin/master by 1 commit")

Once you have the right SHA1, you can look at "How can I see all the files that were modified/added/removed in the last push received?" for more.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • "How can I see all the files that were modified/added/removed in the last push received?" was your initial question, but illustrates diff-tree between two SHA1. – VonC Mar 11 '12 at 09:41
  • Thanks VonC. The thing is no editing is done on this repo. It only receives pushes. So, based on your answer I can get the ID at the last push (which is always HEAD) but what about the ID of the push before that? I'd need those two IDs so I can use diff-tree to see the differences. – trusktr Mar 11 '12 at 18:31
  • @trusktr interesting. That would be the parent of the last merge with `origin/master` and `master`. – VonC Mar 11 '12 at 19:06
  • I found a way to do it. I'm just using the post-receive hook which sends oldrev (old revision ID) and newrev (new revision ID) through stdin so I can do the comparison I need. – trusktr Mar 11 '12 at 21:08