Roman Starkov
Roman Starkov

Reputation: 61382

Why doesn't git update my remote tracking branch?

I have a checkout with two branches. One of them is the main branch in the "origin" remote, and is set up to track that (or so I believe). The other is the active branch, and only exists in this checkout.

Here's the output of git branch -vv:

  Official    9b44ada [origin/Official: behind 5] <commit message>
* MyBranch    aecc225 <commit message>

When I do a git fetch, the output is empty (I do believe I've got all the changes from there), but the Official branch remains like that: behind by 5 commits.

If I try a git pull, the fetch phase is similarly blank, and then I'm warned that there is no tracking information for MyBranch (which is expected).

Why isn't git fetch updating the remote tracking branch Official, and how do I get it to update?

Upvotes: 0

Views: 101

Answers (1)

Craig McQueen
Craig McQueen

Reputation: 43426

If you do a git fetch, then it will update origin/Official, but it won't update your local branch Official to match it.

If you do a git pull, it will fetch, and also update your current branch (but not other branches) to match the remote branch, triggering a merge if needed.

To update the local Official branch to match the remote:

git checkout Official
git pull

Upvotes: 1

Related Questions