Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
262 views
in Technique[技术] by (71.8m points)

Git not displaying pending commits from remote master branch

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!

question from:https://stackoverflow.com/questions/65904978/git-not-displaying-pending-commits-from-remote-master-branch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...