简体   繁体   English

我怎样才能使git-svn摆脱不再存在的远程分支?

[英]How can I make git-svn get rid of remote branches that don't exist anymore?

Is there a handy way to get my local git repo to forget about remote branches that have been deleted? 是否有一种方便的方法让我的本地git repo忘记已被删除的远程分支? git svn fetch doesn't "re-sync everything" like I hoped it might. git svn fetch不像我希望的那样“重新同步一切”。 My local repo was set up with using an import of the standard svn repo layout ( git svn -s … ). 使用标准svn repo布局( git svn -s … )的导入设置了我的本地仓库。

related: Why does git remote not list anything on my git-svn repo? 相关: 为什么git remote没有在我的git-svn repo上列出任何内容?

You can remove orphaned remote branches by executing the following commands: 您可以通过执行以下命令来删除孤立的远程分支:

git branch -d -r my_branch
rm -rf .git/svn/refs/remotes/my_branch

To remove all orphaned branches at once rather than one at a time, see the answer here . 要一次删除所有孤立的分支而不是一次删除一个孤立的分支,请在此处查看答案。

On the first thought, I would suggest trying git remote prune . 在第一个想法,我会建议尝试git remote prune Excerpt from documentation : 摘自文档

prune 修剪

Deletes all stale remote-tracking branches under . 删除所有过时的远程跟踪分支。 These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/". 这些陈旧的分支已经从引用的远程存储库中删除,但仍然在“远程/”中本地可用。

With --dry-run option, report what branches will be pruned, but do not actually prune them. 使用--dry-run选项,报告将修剪哪些分支,但实际上不要修剪它们。

I think this should also work with a remote called svn ... 我认为这也适用于名为svn的遥控器...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM