开发者

Commit differences between local and remote

How can I ask what commits are different between my current local开发者_高级运维 branch and the remote repository that I push to?

Not exactly a git diff origin/master master -- I don't want to see code differences. Just a list of changes like git log.

I want to quickly see how long it's been since I pushed and how out of sync I am.


Git can not send this information remotely.

You would have to do a Git fetch (fetching the changes, without altering your working copy). You will then have a branch called "origin/master" which will enable you to use git log master..origin/master to get the variance between the two.

git fetch
git log master..origin/master


You can see which commits are on origin/master but not yet on master using

git log master..origin/master

To see which commits are on your master which you haven't yet pushed, use

git log origin/master..master


git log HEAD..origin/yourproject --graph


With Visual Studio 2015 and Git version 2.7.1.windows.2, if you just type

git diff origin/master master --name-only

you will receive this:

fatal: ambiguous argument 'origin/master': unknown revision or path not in the working tree.

To work around that, run

git branch -a

which will return something like

* master

  remotes/yourproject

Then use the entire remote path as Git gives it to you, and it will work:

git diff remotes/yourproject master
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜