13

How can one remove unused git bracnhes from Tortoise-Git? These branches have been removed both locally and remotely, i'd like to not see them anymore when using this dropdown

enter image description here

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
  • I think this has been asked here: https://stackoverflow.com/questions/19928808/deleted-remote-branches-still-listed-in-tortoisegit and that answer is pretty good. – joe_flash Feb 01 '18 at 17:23

4 Answers4

20

As of TortoiseGit 2.4.0.2 there is a way to let it execute git remote prune origin. In the Sync window you can select "Clean up stale remote branches" which then will remove all already removed remote branches from your local cache.

I don't know if this already exists in previous versions, because I normally use the command line ^^

Neithan
  • 171
  • 1
  • 3
  • 11
  • perfect! this is the option on the tortoisegit. no command line required. – polras Sep 02 '17 at 19:46
  • Talking about tortoisegit this is the perfect answer! – pergy Jan 23 '18 at 12:37
  • 1
    I almost exclusively use the git log view of TortoiseGit, as I can do everything I need to and see the entire state of the repo from this one view. From the fetch dialog there is a "Prune" checkbox as well that if checked appears to do the exact same thing. This answer led me to discover this. – Barak Gall Jan 28 '19 at 21:23
  • 1
    BTW it's in the "Pull" pull-down menu. – Romulus Urakagi Ts'ai Dec 09 '21 at 02:10
8

You need to run git remote prune origin. This will get rid of remote tracking branches which no longer represent a branch on the remote.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
0

You can do 'view log' and then scroll down to where you see the branch marker, right-click and ask to delete it. Typically you will see it twice as foo and origin/foo and you may want to delete both.

I have not found a way to do the equivalent of git remote prune origin from the TortoiseGit GUI.

Ed Avis
  • 1,350
  • 17
  • 36
0

Maybe you just pruned/removed the branches and the cache is not up-to-date. You could kill the tgitcache.exe process to reset the cache.