Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleted remote branches still listed in TortoiseGit

I have noticed TortoiseGit seems to contain every feature branch I ever created, both in drop-downs for local branches AND remote, even though many of the remote branches were deleted after being merged into master.

Is there a way in TortoiseGit to synhronise which branches are listed to those actually existing?

And a slight tangent... in terms of Git itself is a local version of a branch considered totally decoupled from the remote? i.e. there is no reason why deleting the remote version should automatically mean the local one is deleted?

like image 323
Mr. Boy Avatar asked Nov 12 '13 12:11

Mr. Boy


People also ask

How do I get rid of remote branch?

To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .

What happens when you delete a remote branch?

Deleting both a local and a remote branchThey are completely separate objects in Git. Even if you've established a tracking connection (which you should for most scenarios), this still does not mean that deleting one would delete the other, too!

Does git prune delete remote branches?

git fetch --prune is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repository.

Does deleting local branch delete remote branch?

In Git, local and remote branches are separate objects. Deleting a local branch doesn't remove the remote branch.


1 Answers

You can do, as mentioned in issue 1139, a Fetch with prune.
Or remove Remote Branch from list in Pull issue 2765.

That will clean-up any remote branches still locally referenced, while they are already deleted in the upstream repo.

http://wiki.typo3.org/wiki/images/1/18/Tortoisegit_fetch.gif

in terms of Git itself is a local version of a branch considered totally decoupled from the remote?

It can be.
If a branch has an remote tracking branch associated to it, git branch -vv can show it.

But removing said remote tracking branch has no bearing on the local branch.

i.e. there is no reason why deleting the remote version should automatically mean the local one is deleted?

Sure: you pushed by mistake a 'test' branch:

  • you want to delete it on the remote repo
  • but you very much want to keep it on your local repo to pursue some local tests you have no intention of pushing.
like image 127
VonC Avatar answered Sep 18 '22 20:09

VonC