threads / discuss / 18896

how to check what your pulling down?

Subject: how to check what your pulling down?

## tl;dr

4 messages between Apr 16, 2009 and Apr 16, 2009.

replies: 3people: 4as markdown or json

cantona· Apr 16, 2009, 11:00 UTC · lore
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
-- 
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.
Jeff King· Apr 16, 2009, 11:07 UTC · re: cantona · lore

Re: how to check what your pulling down?

On Thu, Apr 16, 2009 at 04:00:08AM -0700, cantona wrote:
> 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
Junio C Hamano· Apr 16, 2009, 16:46 UTC · re: cantona · lore

Re: how to check what your pulling down?

cantona <adam@dwpub.com> writes:
Show 5 quoted lines
> 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..
Matthieu Moy· Apr 16, 2009, 17:03 UTC · re: Junio C Hamano · lore

Re: how to check what your pulling down?

Junio C Hamano <gitster@pobox.com> writes:
Show 10 quoted lines
> cantona <adam@dwpub.com> writes:
>
>> 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.

-- 
Matthieu

← back to recent threads