What are the differences between git remote prune, git prune, git fetch –prune, etc

My situation is this… someone working on the same repo has deleted a branch from his local & remote repo…

Most people who have asked about this kind of problem on Stack Overflow, or other sites have the issue of branches still showing in their remote tracking branch list git branch -a at the bottom:

* master
  develop
  feature_blah
  remotes/origin/master
  remotes/origin/develop
  remotes/origin/feature_blah
  remotes/origin/random_branch_I_want_deleted

However, in MY situation the branch that shouldn’t be there, is local:

* master
  develop
  feature_blah
  random_branch_I_want_deleted
  remotes/origin/master
  remotes/origin/develop
  remotes/origin/feature_blah

When I do any of the following, it doesn’t get removed locally:

$ git prune

I also tried:

$ git remote prune origin
$ git fetch --prune

More useful info: When I check git remote show origin this is how it looks:

* remote origin
Fetch URL: utilities:homeconnections_ui.git
Push  URL: utilities:homeconnections_ui.git
HEAD branch: master
Remote branches:
 master                        tracked
 develop                       tracked
 feature_blah                  tracked
 other123                      tracked
 other444                      tracked
 other999                      tracked
Local branches configured for 'git pull':
 develop                      merges with remote develop
 feature_blah                 merges with remote other999
 master                       merges with remote master
 random_branch_I_want_deleted merges with remote random_branch_I_want_deleted
Local refs configured for 'git push':
 develop         pushes to develop     (local out of date)
 master          pushes to master      (up to date)
 feature_blah    pushes to feature_blah(up to date)

Notice that it’s only in the section titled Local branches configured for 'git pull':

Why?

4 Answers
4

Leave a Comment