Honghe.Wu
Honghe.Wu

Reputation: 6829

How to update local git tracking of remote repo when it delete a branch

Such as, I have deleted the patch-1 branch in github.com, and run git fetch origin to update local repo to track the remote, but the command git branch -a still show I local repo tracking remotes/origin/patch-1.

$ git branch -a
* master
  origin
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/patch-1

So, how to update my local repo?
Thx!

Upvotes: 1

Views: 93

Answers (1)

jthill
jthill

Reputation: 60393

You're after git fetch --prune / git fetch -p,

-p
--prune

After fetching, remove any remote-tracking branches which no longer exist on the remote.

Upvotes: 6

Related Questions