1

I had a remote branch that I was already using and I wanted to update the refs on it, so I typed git fetch <remote> <branch> and the branch did not update with the latest refs. I found I had to use git fetch <remote> (without a branch) to get the current remote updates on that branch. Could someone please explain?

0

1 Answer 1

4

git fetch <remote> <branch> will fetch the single given branch from the given remote and store it in FETCH_HEAD.

git fetch <remote> will use the default refspec which is usually configured as remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* and therefore will fetch all branches and stores them in the corresponding remote branch.

Sign up to request clarification or add additional context in comments.

1 Comment

Unless I'm missing something, I don't see the specific (and apparently additional) step that git fetch <remote> is performing over git fetch <remote> <branch> when encountering the specific <branch>. Do you know what that is?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.