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: 1179
Joined: Sun Dec 20, 2009 1:23 pm

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

Post by oldman »

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 - debugging - bug reporting - compiling - ISO remaster.
They may help you with a problem, so do have a look at them.
User avatar
Fraizeraust
Posts: 234
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 »

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.
a.k.a. GeoB99 -- ReactOS Kernel developer -- My Wiki page
oldman
Posts: 1179
Joined: Sun Dec 20, 2009 1:23 pm

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

Post by oldman »

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 - debugging - bug reporting - compiling - ISO remaster.
They may help you with a problem, so do have a look at them.
User avatar
Fraizeraust
Posts: 234
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 »

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".
a.k.a. GeoB99 -- ReactOS Kernel developer -- My Wiki page
hbelusca
Developer
Posts: 1204
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 »

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: Google [Bot] and 27 guests