Reputation: 1103
I have two cloned versions of a repo (working copies) - say A and B. Now, in B, I made changes to file filename
, committed and pushed. A is untouched. Now, before pulling in A, I want to see what new changes will a pull
bring in.
I tried:
git diff
git diff HEAD
git diff HEAD:filename filename
but none of them show the diffs (blank output). How to correctly view diff between local copy and head (I checked other answers, and my understanding of them is the above, but none of them seem to work).
Note: I have recently moved from svn to git. So the way I am thinking is: A & B are just copies of same "branch". Not sure if the understanding/terminology is correct.
Upvotes: 3
Views: 1595
Reputation: 1328602
You need to fetch first, then you can look for the diffs:
cd A
git remote add B /path/to/B
git fetch B
git diff master B/master
You can see other diffs in "How can I see incoming commits in git?"
I have installed gitolite on a server. And there is a repo there, say
ProjectXYZ
.
Now,A
andB
are obtained on two different machines, usinggit clone user@reposerver:ProjectXYZ.git
.
Then:
# on machine B
cd B/
git push -u origin master
# on machine A
cd A/
git fetch
git diff master origin/master
Upvotes: 4