What is wrong with 'git pull' to update a local source tree

Ask your support questions in here

Moderator: Moderator Team

Post Reply
oldman
Posts: 1072
Joined: Sun Dec 20, 2009 1:23 pm

What is wrong with 'git pull' to update a local source tree

Post by oldman » Fri Sep 07, 2018 12:38 pm

I use git pull origin to update my local source tree, but the wiki (https://reactos.org/wiki/ReactOS_Git_For_Dummies) says "We don’t recommend using pull, but rather to use fetch and rebase."

What is wrong with pull?
Please keep the Windows classic (9x/2000) look and feel.
The layman's guides to - debugging - bug reporting - compiling - with some complementary scripts.
They may help you with a problem, so do have a look at them.

Fraizeraust
Posts: 228
Joined: Thu Jan 05, 2017 11:46 am
Location: Italy
Contact:

Re: What is wrong with 'git pull' to update a local source tree

Post by Fraizeraust » Fri Sep 07, 2018 1:42 pm

As per these two links:

https://stackoverflow.com/a/7104747
https://www.git-tower.com/learn/git/faq ... h-git-pull

The point being if you have any uncommitted changes in your directory tree, the recommended option is to fetch and rebase your local repository without breaking your local changes. git pull should be used ONLY when your working directory is clean.

oldman
Posts: 1072
Joined: Sun Dec 20, 2009 1:23 pm

Re: What is wrong with 'git pull' to update a local source tree

Post by oldman » Fri Sep 07, 2018 2:12 pm

Thanks Fraizeraust.

So for those of us that only use a local copy of trunk to compile, then git pull is OK.

If I have merged a patch into my local copy and want to preserve the merge, but update from master, then I would need to use fetch and rebase.

Is that correct?
Please keep the Windows classic (9x/2000) look and feel.
The layman's guides to - debugging - bug reporting - compiling - with some complementary scripts.
They may help you with a problem, so do have a look at them.

Fraizeraust
Posts: 228
Joined: Thu Jan 05, 2017 11:46 am
Location: Italy
Contact:

Re: What is wrong with 'git pull' to update a local source tree

Post by Fraizeraust » Fri Sep 07, 2018 3:17 pm

oldman wrote:So for those of us that only use a local copy of trunk to compile, then git pull is OK.
In this case yes. You can safely do a pull from the upstream "master branch" repository to your origin (forked/local) repository.
oldman wrote:If I have merged a patch into my local copy and want to preserve the merge, but update from master, then I would need to use fetch and rebase.
You're correct. git apply will result to the specific XYZ file (depending on the patch) being un-staged for the commit thus uncommitted. For this matter you've got to fetch your repository which means it'll download the objects and refs from another repository and then rebase.

After all, git pull is basically a combination of "git fetch" and "git merge". git pull is not bad per se, what does it matter the most is WHEN you use it. And when it comes to un-staged file(s) (the modifications done to the file) you have a high chance of probability to get a merge conflict due to "git merge".

hbelusca
Developer
Posts: 1133
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: What is wrong with 'git pull' to update a local source tree

Post by hbelusca » Fri Sep 07, 2018 10:23 pm

Aside note: we want to have linear history (and not a bush-tree history) when stuff is later committed.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest