Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34026

Delete all remote tracking branches for a remote git repository

I somehow added a fork as a remote to my local repository and later on I issued git pull - to my dismay git pulled all fork branches as local tracking branches. How can I undo this with one command ? All branches show in gitk as remote/wr/branchname

Do I then have to remove the entry from .git/config ?

[remote "wr"]
    url = https://github.com/AUTHOR/wrye-bash.git
    fetch = +refs/heads/*:refs/remotes/wr/*

Upvotes: 0

Views: 795

Answers (1)

Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34026

Took me a bit of experimentation (I am not a console person):

git branch -rd $( git branch -r | grep 'wr/' )

Now if only I could add a dry run switch...

Upvotes: 1

Related Questions