Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git - delete local tracking

Tags:

git

git-remote

I've deleted some remote branches (dev/featureA and dev/featureB) however when I run git remote show origin I still see them being listed under the local branches section. E.g.

$ git remote show origin

Local branches configured for 'git pull':
  dev/featureA                  merges with remote dev/featureA
  dev/featureB                  merges with remote dev/featureB

Do I need to disable tracking or something similar?

like image 467
Snowcrash Avatar asked Feb 10 '23 13:02

Snowcrash


2 Answers

This one worked for me

 git branch -r -d dev/featureA
like image 100
Developer Avatar answered Feb 12 '23 03:02

Developer


To remove the remote repository from being tracked all together locally, do the following: git remote remove <remoteRepo>

To explicitly remove only the upstream tracking for a specific local branch , do the following: git branch --unset-upstream <branch name>

git branch --unset-upstream dev/featureA

To remove all stale local branches that are not longer available at the remote, do the following:

git remote prune <remoteRepo>

I'd be careful with the last one and do a --dry-run of the prune first...

More information is available http://git-scm.com/docs/git-branch

and

http://git-scm.com/docs/git-remote

like image 23
g19fanatic Avatar answered Feb 12 '23 04:02

g19fanatic