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?
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 .
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!
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.
In Git, local and remote branches are separate objects. Deleting a local branch doesn't remove the remote branch.
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.
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With