How can I make git-svn get rid of remote branches

2019-03-13 02:58发布

Is there a handy way to get my local git repo to forget about remote branches that have been deleted? git svn fetch doesn't "re-sync everything" like I hoped it might. My local repo was set up with using an import of the standard svn repo layout (git svn -s …).

related: Why does git remote not list anything on my git-svn repo?

标签: git git-svn
2条回答
混吃等死
2楼-- · 2019-03-13 03:22

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.

查看更多
Root(大扎)
3楼-- · 2019-03-13 03:22

On the first thought, I would suggest trying 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.

I think this should also work with a remote called svn...

查看更多
登录 后发表回答