osgmja
Last Updated: February 25, 2016
·
1.289K
· bdcribbs
38d766f23d544ca258e4fe2110104c16

Please, oh please, use git fetch

git

When working on a project you usually synchronize your code by pulling it several times a day. What you might not know is that "git pull" is two things at once. It is a "git fetch" followed by a "git merge". If you do not understand the difference, you should ask your co-workers who understand Git better than you to explain. If you still do not understand, you should only fetch, and then ask someone on your team to help you understand.

Say Thanks
Respond

5 Responses
Add your response

6101
5e47e75af9d584936f6b4be3520c75d7

:+1: I always use git fetch now, for it shows you new branches, new tags and so on.

over 1 year ago ·
16184
Avatar

I use git fetch as part of my workflow to keep track of several remote contributors work across several branches.

This is more an opinion piece that talks down to people who might not be aware of or sufficiently familiar with Git and DVC to understand why they should be using the command. Using an example and clarifying why and what they should be doing would more useful as a Protip. :)

over 1 year ago ·
16185

I say use git pull if you want to but one should know how to git fetch + git merge do and when they may be better than pull. :)

over 1 year ago ·
16186
17067d2b093b19e61189d9cc8d20f939

Saying "Don't use X, but ask somebody else why" is no tip, but a waste of time. Anyway, the tip is not completely right too: There is nothing wrong with git pull, as long as you know, what you are doing (ask your coworker ;)). It is somehow ironic, that I've found the real answer on coderwall: https://coderwall.com/p/tnoiug

In short: Setup git to perform a rebase instead of a merge after pull for you, instead of doing it on your own manually every time.

over 1 year ago ·
16187
7455fbe2cde016f6cd36b4352be52eaf

"There is nothing wrong with git pull, as long as you know, what you are doing (ask your coworker ;))."

But it is for that reason I can't recommend 'pull' to novices, it makes them do the wrong thing, and impedes them from understanding the git 'model'.

It is initially more convenient. But convenience at the price of doing the wrong thing is a steep penalty.

over 1 year ago ·
Filed Under