Question

My origin has a fixes and a fixes_v3 branch. My client has just fixes. I do a git pull git+ssh:/.../mygitrepo and suddenly on my client I have all the fixes_v3 code in the fixes branch. Why on earth did this happen? Now I try git pull ... mygitrepo fixes and it just tells me it's up to date.

git remote show origin gives this:

HEAD branch: fixes
Local refs configured for 'git push':
  fixes  pushes to fixes  (fast-forwardable)
  master pushes to master (up to date)
Was it helpful?

Solution

Apparently your branches are tracking the false remotes. Do a git remote show origin to see which branch remote branch fixes merges. It probably will say something like

fixes merges with remote fixes_v3

Adjust this accordingly after undoing your last merge.

OTHER TIPS

The quick fix?

Undo all local commits. E.g.

Select branch for undo

git branch fixes

Remove local commits

git reset --hard origin/fixes

Source

How did the topic branch get messed up?

In my case, I'd done a pull without naming the destination:

git pull origin cifs_support

Since there was no local cifs_support branch, the commits from origin/cifs_support were added to master.

Are you safe?

No. Check your config using the advice in the accepted answer: use git remote show origin to see which branches are affected by git pull and git push. If branch tracking is wrong, fix it ASAP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top