PKlammer
PKlammer

Reputation: 21

TortoiseGit local branches vs. remote branches at GitHub

I recently cloned one of our repositories from GitHub and just today, as I was executing a "Switch/Checkout to this ..." noticed that my local branch references (green boxed names) don't agree with remote branches (tan boxed names). I'll try to insert screenshot to show what I mean:

enter image description here

And in Browse References I can see a bunch of Branch Name references that all point to origin/master:

enter image description here

I see I can fix this if I Switch/Checkout to each one, with Create New Branch and Override Branch If Exists, but why should I have to do this?

Upvotes: 2

Views: 520

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21918

About branches "pointing to master"

They don't. They happen to point at the same commit master also points to, but this is not a problem per se. It means that these branches either have been freshly created from master, or have been resynced with master recently (many possible scenarios for that, depending on your workflow), which is totally fine.

About branches not in sync with their remote counterpart

It looks like some of these branches have new commits which are yet unknown to your local versions of the branches.

Your "I can fix this" leads to replacing the (more advanced) remote references with your (older) versions. It would make it look right from your local, but this will undermine someone else's work (dyang?).

So you'd have to inspect these new commits (who's the author? what are the changes?) and probably pull them into your local repo. This will also "fix" the situation and resync local with remote, but on the most recent version rather than an older one.

In case you want to avoid doing it via TortoiseGit and be sure to update some branch via CLI :

git checkout <some-branch>
git pull

Upvotes: 2

Related Questions