Reputation: 56931
From a git branch, a colleague of mine ran
git diff origin master
What is it supposed supposed to do? What does origin
separately point to?
This is related, but not covered in In Git, what is the difference between origin/master vs origin master?
Upvotes: 11
Views: 35841
Reputation: 489065
This form of git diff
just takes two revision specifiers, as described in gitrevisions.
In this case origin
is most likely to match item 6:
- otherwise,
refs/remotes/<refname>/HEAD
if it exists.
So this means the same as git diff origin/HEAD master
: resolve origin/HEAD
to a commit-ID, resolve master
to a commit-ID, and diff the two commits.
Run:
git rev-parse origin
to see how the resolution works.
Upvotes: 6
Reputation: 2179
"origin" points to the "remote", typically where you cloned the repository from, see
$ git remote -v show
But specifically in answer to your question "git diff origin master" is equiv. to this:
$ git diff origin/HEAD master
origin/HEAD to the branch pointed to by HEAD reference on the remote. Which was the checked out branch at last pull.
Take a look at your commit graph, which will show you where all your references are (--decorate)
$ git log --oneline --graph --all --decorate
Upvotes: 3
Reputation: 3055
It shows the changes between the tips of origin/HEAD and the master branches. You can achieve the same with following commands:
Usually origin points to the source from where you cloned your repository.
Upvotes: 2
Reputation: 11831
It depends... if origin
and master
are branches, it shows the difference between them. When looking over explanations, they usually use origin
to stand for the original (upstream, official, whatever) branch, and master
for the branch you are working on. I.e., "show me what changed with respect to the original version."
Upvotes: 1