0

OK, there are a lot of answers around this topic, and perhaps I have an environmental problem, but wanted to see if there is some secret GIT sauce I am missing.

I am having problems getting my local repo in sync with GitHub. When I run git branch -a I get this list:

Gideon
Qs
SK-tabfix
dev
list
master
new-metrics
sk-notifications
* sk-utf-fix
remotes/origin/GG-dev
remotes/origin/HEAD -> origin/master
remotes/origin/KH-dev
remotes/origin/dev
remotes/origin/master
remotes/origin/sk-utcoverage
remotes/origin/sk-utf-fix
  • I've run git fetch -p -f - no change.
  • I've run git remote prune origin - no change.
  • I've run git pull --prune - no change.

Obviously I can manually delete the local branches, but I cannot understand why prune is failing me here.

Shanerk
  • 5,175
  • 2
  • 40
  • 36
  • 1
    Possible duplicate of [Remove tracking branches no longer on remote](https://stackoverflow.com/questions/7726949/remove-tracking-branches-no-longer-on-remote) – Shanerk Dec 11 '18 at 16:59

1 Answers1

1

Local branches are not meant to be affected by any of the commands your are showing.

git remote prune only prunes remote-tracking branches, not local ones.

Similarly, git fetch -p or git pull --prune will only affect remote-tracking branches. The remote-tracking branches are the ones named remotes/origin/....

The local branches whose upstream is a remote-tracking branch are still local and must be deleted with git branch -d or git branch -D.

joanis
  • 10,635
  • 14
  • 30
  • 40
  • Hmm. The interesting thing is all those branches did exist on remote and some were actually merged. So I'd expect that history to be reflected during a fetch. For instance: ```git fetch --prune From https://github.com/redargyle/csvuploader - [deleted] (none) -> origin/SK-tabfix - [deleted] (none) -> origin/sk-notifications``` – Shanerk Dec 11 '18 at 16:57