0

I pushed a feature branch to a remote repository.

How can I verify the remote repository has the exact same things as what I pushed, so that others can pull my feature branch or merge it into the master?

Thanks.

Community
  • 1
  • 1
Tim
  • 1
  • 141
  • 372
  • 590
  • Any git client (e.g Smart Git) can show you if you have pending commits or pushes between local and remote repository – apomene Feb 06 '17 at 14:27
  • I use command line. – Tim Feb 06 '17 at 14:29
  • maybe this helps https://gist.github.com/leroix/8829846 – apomene Feb 06 '17 at 14:30
  • Why do you think it wouldn't be successful? If Git doesn't tell you it failed, then it succeeded. You can read the output, or just test the exit status of the command (using the `$?` shell variable). Are you worried about silent corruption on the wire or at the remote end? – Jonathan Wakely Feb 06 '17 at 14:37
  • @JonathanWakely yes. I will feel safe when another person can pull my feature branch and switch to it and find the exact stuffs as what I pushed. – Tim Feb 06 '17 at 14:49
  • Stop worrying. All Git's metadata is verified by SHA256 so if the command succeeds, then the push succeeded and the data is there. – Jonathan Wakely Feb 06 '17 at 15:07
  • @JonathanWakely actually it's SHA-1 and not SHA-256... and neither has anything to do directly with whether the push actually succeeded when it claims to have done so. I agree with the "stop worrying", though. :) – Jan Krüger Feb 06 '17 at 15:14
  • @JanKrüger Oops, of course it is, thanks. My point is really that if the command says the remote received the data, then doing a `fetch` to check it _still_ thinks it got the data is unnecessary. If the remote says its HEAD is the same commit as the local HEAD, doing an extra `fetch` won't "verify" anything, it'll just say the two repos match. – Jonathan Wakely Feb 06 '17 at 16:19
  • 1
    @JonathanWakely yeah, definitely. All these extra steps can help ease your mind if you're not completely certain how everything works, I suppse, but in the end what `push` says is Truth(tm) and the sooner you get used to it, the better. – Jan Krüger Feb 06 '17 at 16:23

2 Answers2

1

Compare (see difference) between your local/feature and remote/feature.

$ git fetch                          # update local with remote changes
$ git checkout feature               # go to feature branch 

$ git diff origin/feature..feature   # show what is in feature that is not in origin/feature

If you don't see any change then your remote/feature is sync with local/feature.

You can also go to your repo's feture branch using browser and see if the last commit is same as your local feature's last commit.

Sajib Khan
  • 22,878
  • 9
  • 63
  • 73
0

How can I verify the remote repository has the exact same things as what I pushed, so that others can pull my feature branch or merge it into the master?

You can use git log and specify the remote repo and branch, like:

$ git log origin/my-branch

If you see the commits you just pushed in the remote branch's log, then the push was successful.

Caleb
  • 124,013
  • 19
  • 183
  • 272