如何删除未使用的 git 分支
如何从 Tortoise-Git 中删除未使用的 git bracnhes?这些分支已在本地和远程删除,我希望在使用此下拉列表时不再看到它们
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
从 TortoiseGit 2.4.0.2 开始,有一种方法可以让它执行 git remote prune origin 。在“同步”窗口中,您可以选择“清理过时的远程分支”,这将从本地缓存中删除所有已删除的远程分支。
我不知道这个在以前的版本中是否已经存在,因为我通常使用命令行^^
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 ^^
您需要运行 git Remote prune origin 。这将摆脱不再代表远程分支的远程跟踪分支。
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.也许您只是修剪/删除了分支并且缓存不是最新的。您可以终止 tgitcache.exe 进程来重置缓存。
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.您可以执行“查看日志”,然后向下滚动到看到分支标记的位置,右键单击并要求删除它。通常,您会看到它两次为 foo 和 origin/foo,并且您可能想删除两者。
我还没有找到一种方法可以从 TortoiseGit GUI 执行与 git Remote prune origin 相同的操作。
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.