2

I have created and checked out branch test1. i did some changes and commited. assume test1 branch having three commits. now i am creating branch called test2 (test1 is not pushed to central server) and push test2 to central server. as per the below link i am getting all the three commits. but when i push test1 to central server, not listing the three commits.

i want the three commits listed during test1 branch push operation. how do i get it?

How to get a list of incoming commits on git push for a new branch in a hook

Community
  • 1
  • 1
Seenivasan
  • 101
  • 1
  • 2

1 Answers1

1

If you created test2 on top of test1, you effectively pushed test1 commits by pushing test2.

The second push (for test1) would not push any new commits. Only test1 pointer on one of those (already pushed) commits.
That explains why your hook didn't list new commits: there was no "$new_sha1".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for your reply. I understand this, but is there any other way to get test1 list of commits? – Seenivasan Aug 01 '12 at 07:32
  • @Seenivasan yes, based on http://stackoverflow.com/questions/53569/how-to-get-the-changes-on-a-branch-in-git – VonC Aug 01 '12 at 07:34
  • i run the command "$ git log ..test1 --no-merges --format='%h | %s' --date=local"...it lists test1 branch as well as the previous branch (master) commits. not exactly what i am expecting. – Seenivasan Aug 01 '12 at 11:01
  • @Seenivasan Yes, you need to run it against the branch from which test1 originated, in order to get all commits in one, but not in another, as illustrated in the question I reference. – VonC Aug 01 '12 at 11:02
  • Ok, In my case, i dont know where test1 is originated. also when you push to central server how we can run this command in orginate branch. by default master right? pls correct me if i am wrong – Seenivasan Aug 01 '12 at 11:12
  • @Seenivasan You should know the branch from which test1 comes from: http://stackoverflow.com/a/3999040/6309 . If that branch has been pushed too, then you can make the `git log` on the server side. – VonC Aug 01 '12 at 11:26