Skip to contentSkip to conversation

how to check what your pulling down?

DISCUSSION cantona 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

cantona

author
#0 lore raw

Hi

I've been using basic git for a while (add,comit,push,pull) and have recently discovered stash,merge,branch :)

My question: before I pull down I always get that bad feeling... "what am i gunna get? will there be a conflict?". Is there a git command to check what will come down with the next pull? If not, a command that will tell you which local files differ from the git repository files?

Thanks

Signature · 2 lines
View this message in context: http://www.nabble.com/how-to-check-what-your-pulling-down--tp23075475p23075475.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw
Quoted 4 lines · cantona

My question: before I pull down I always get that bad feeling... "what am i gunna get? will there be a conflict?". Is there a git command to check what will come down with the next pull? If not, a command that will tell you which local files differ from the git repository files?

Pull is just fetch+merge, so you can do:

  $ git fetch $remote
  $ git log ..$remote/$branch

to see how they differ from you. And then "git merge $remote/$branch" if you like it.

-Peff

#2 lore raw
In reply to cantona
Quoted 5 lines · cantona

I've been using basic git for a while (add,comit,push,pull) and have recently discovered stash,merge,branch :)

My question: before I pull down I always get that bad feeling... "what am i gunna get? will there be a conflict?".

"will there be a conflict?" is an unfounded fear people seem to be unable to shake off from their old scm days. As long as you start from a fully committed state, you can always "git pull", and if it resulted in conflicts you cannot resolve, you can "git reset --hard" it away.

With a distributed system, you can afford to fully commit your local changes before you pull. If they are of dubious quality, you just create a separete "my-wip" branch to commit them there, come back to the "master" branch that does not have unfinished changes and run "pull".

On the other hand, even if there weren't any conflicts, it is often good to check what you have pulled (especially if you are in the position to say "Nah, this is no good, and I am not going to pull from you now. Please redo these changes." You do that by by:

git pull
git log -p ORIG_HEAD..

#3 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · cantona

I've been using basic git for a while (add,comit,push,pull) and have recently discovered stash,merge,branch :)

My question: before I pull down I always get that bad feeling... "what am i gunna get? will there be a conflict?".

"will there be a conflict?" is an unfounded fear people seem to be unable to shake off from their old scm days.

But still, if you want to know what's new without touching your work at all, "git fetch" is your friend: it fetches new commits from another repository, without merging them with your branches. Running "gitk --all" right after a "git fetch" should help understanding what it did.

Signature · 1 line
Matthieu