Sorry if this was answered somewhere else. I've looked at several threads, but to no avail :(
Simple question. We have a remote master branch. A Dev has committed several changes to that remote master branch. I need to apply those to a local branch (the QA server, actually; no dev here), but before doing that, I want git to tell me which commits are pending.
I've tried several combinations of "git diff", using the results from "git branch -a", but nothing came back. Always empty.
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/respaldo
$
$ git diff HEAD master
$ git diff HEAD origin/master
$ git diff master origin/master
$ git diff master remotes/origin/master
$ git log origin/master..HEAD
$ git diff origin/master..HEAD
$
What am I doing wrong?
Thanks a lot!
What am I doing wrong?
Almost all Git operations work on your local information. It looks like your master
branch and your origin/master
one point to the same commit. You probably need to fetch
the changes first.
I don't want to do any changes yet. I understand "fetch" will change something locally... right? Is there any "read-only" way of telling this?
Yes and no. fetch
will not change your local master
branch. What it will do is download the updates that happened to origin/master
, that is, your local copy of the remote branch. So, in a way, there will be changes, but not to master
which is supposedly what you care about.
Git doesn't work like SVN or CVS where they are all the time contacting the server (because they don't have the information locally). Instead, you fetch
changes whenever you need, and then everything else is local without involving any network calls.