Can't see differences in remote branch after a git fetch
I'm a little confused about git fetch and comparing differences .
I have the following local branches;
- master
- remote/origin/master
In master branch I have a text file which I make changes to, commit and then push to the ori开发者_运维百科gin/master.
In another local repo (for test purposes) I have a remote to the same repo as above. I run
- git fetch origin master
- git diff master origin/master
It displays no differences, but if i do git pull origin master
it pulls and merges the changes I made to the text file. I'm probably wrong but I thought a pull did a fetch and a merge, so doing a fetch allowed me to see the changes to the remote branch before merging them.
What you need to do to perform a diff (after a fetch) in respect to the head of your branch and the origin at the same branch is a
git diff HEAD...origin
Please note the 3 dots. By the way, the question can possibly be considered a duplicate of this one, at least in terms of the accepted answer.
精彩评论