0

Suppose I have already run git fetch, and now I want to run git pull, to bring my local myBranch up-to-date with my origin\myBranch.

BUT!! in the mean time, after running the fetch, my internet connection has dropped :( Now, when I run git pull it fails, because it can't see remote. But I'd like to still do the local portion of the pull.

Is there a way to tell git pull to run without doing the initial git fetch?

NOTE: I could git reset --hard to update myBranch. But git pull doesn't always just do that.

I guess another way to phrase the question is "What second command satisfies: git pull = git fetch + git ???"?

2 Answers 2

5

git pull is actually git fetch + git merge:

3
  • oh, is that all? Huh. Cool.
    – Brondahl
    Commented Jul 25, 2017 at 13:14
  • 1
    As the documentation explains: "In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD."
    – axiac
    Commented Jul 25, 2017 at 13:16
  • The easiest way to bring your local working copy up to date is merging your local copy of the remote repo (which git fetch updated): git merge origin/myBranch.
    – gucce
    Commented Jul 25, 2017 at 14:24
1

In fact it depends on your configuration.

In a default configuration, if you're on my_branch which has its upstream as origin/my_branch, then git pull can be considered as

get fetch
get merge origin/my_branch

Configuration (or command line arguments) can change what will be merged. Configuration can also change the 2nd step from a merge into a rebase. So when you say

"What second command satisfies: git pull = git fetch + git ???"?

there's no one answer to what ??? is, but by default it would be merge.

Not the answer you're looking for? Browse other questions tagged or ask your own question.