ack
ack

Reputation: 14985

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.

Upvotes: 37

Views: 25805

Answers (4)

user3511585
user3511585

Reputation: 41

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

Upvotes: -1

Silfverstrom
Silfverstrom

Reputation: 29348

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

Upvotes: 60

ct.kuo
ct.kuo

Reputation: 129

git log HEAD..origin/yourproject --graph

Upvotes: 2

Ben James
Ben James

Reputation: 125327

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

Upvotes: 43

Related Questions