Git - remove local tracking

I removed several remote branches ( dev/featureA

and dev/featureB

), however, when I run git remote show origin

, I still see that they are listed in the local branches. For example.

$ git remote show origin

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

      

Should I turn off tracking or something like that?

+3


source to share


3 answers


To remove a remote repository from local tracking, follow these steps: git remote remove <remoteRepo>

To explicitly remove only upstream tracking for a specific local branch, follow these steps: git branch --unset-upstream <branch name>

git branch --unset-upstream dev/featureA

To remove all obsolete local branches that are no longer available on the remote, follow these steps:

git remote prune <remoteRepo>



I'll be careful with the latter and make --dry-run

blacks first ...

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

and

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

+1


source


Snow try the following command:

git fetch origin --prune

      



This command is for deleting remote branches. If not, go to the page and see if this command helps you. Hello!

+1


source


This worked for me

 git branch -r -d dev/featureA

      

+1


source







All Articles