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 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?

-------------Problems Reply------------

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. Excerpt from documentation:


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...

Category:git Views:1 Time:2010-12-08
Tags: git git svn

Related post

  • Git-svn: Bulk removing orphaned remote branches 2011-05-06

    A project in SVN I'm working on (via git-svn) has frequently-created branches that are then --reintegrated with trunk, and then deleted. Right now the project has about 10 branches that have not been deleted, but in git, git branch -r shows about 50.

  • Changing remote tracking branches in git(-svn) after clone with restricted branches 2011-09-16

    When restricting remote branches to a list of 2 or three (editing the .git/config as seen in {^1}), refetching, carbage collectioning and cleaning all "refs" directories I still get a full list of all remote branches with git branch -avv {^2} I expec

  • git-svn isn't committing to branches, only trunk 2009-08-23

    I'm working with an SVN repository that is laid out like this: $SVN/[project]/trunk $SVN/[project]/branches/[user]/[branch] $SVN/[project]/tags/releases/[tag] My .git/config looks like this: [svn-remote "svn"] url = $SVN fetch = project/trunk:refs/re

  • Can Git-svn be used on large, branched repositories? 2010-01-08

    I am trying to use git as a frontend to a svn repository in order to be able to use git's nice features like simple branching, stashing etc. The problem is that the SVN repository is quite large (8,000 revs) and contains lots of branches and tags (ol

  • Git-svn: create & push a new branch/tag? 2010-03-22

    After cloning an SVN repository using git-svn with the -s option (git svn clone http://server/repo -s), how does one create a branch or tag and have pushed to the relevant branch/tag directory in the repository when dcommiting? For instance; if I wer

  • git-svn creates a lot of branches appended with @rev 2011-05-11

    Possible Duplicate: git-svn clone | spurious branches I converted an SVN repo to git with git-svn. Everything seems to be fine, but there a lot of branches named [email protected] (i.e. remotes/[email protected]), which are not in SVN. Does anybody kno

  • git-svn merging between multiple remotes 2011-06-30

    I have git-svn setup to track two remote svn locations, say http://svnserver/develop/project and http://svnserver/release/project . I also created local branches of the remotes in order to make changes and dcommit to them. However, when I try to merg

  • git svn and working with private branches? 2011-10-03

    new git user here. I want to use git, but i'm in an SVN environment. From some books I've read and some simple experimenting, I've hit some troubling pitfalls and am hoping to get clarification on how to get starting without my colleagues wanting to

  • Can I use git-svn to clone a specific branch of a remote SVN repo and commit back to it? 2012-04-10

    I have a very large codebase with many tags and branches on a remote SVN server. I'd like to use git to clone a specific branch to work on, then eventually merge it back to the remote SVN. Is this possible? Most documentation I've seen doesn't direct

  • Git is driving me nuts, how can I create a new remote branch based on an existing non-master branch? 2010-06-08

    I'm sure this is very simple to do, but I have followed a number of tutorials and cannot figure this out. I currently have two branchs on my remote & local machines: master *search_refactor We want to create a new remote branch called design_refa

  • Using git pull to track a remote branch without merging 2010-06-16

    I am using git to track content which is changed by some people and shared "read-only" with others. The "readers" may from time to time need to make a change, but mostly they will not. I want to allow for the git "writers" to rebase pushed branches**

  • Git - How to track a remote branch that you created from a local branch? 2010-11-08

    Here's the scenario. I have a series of commits in branch my_new_branch I want to push this branch up to the remote repo as a different name and track it. If I do: git push origin my_new_branch:different_name it pushes the branch up fine. But if I st

  • How do you rebase a git-svn branch and keep the metadata intact? 2011-06-16

    I recently used git svn branch to create a branch (in both Subversion and git). I noticed that (for some reason I'm not sure about; maybe a bug or maybe I created the branch incorrectly?) the git commit for the branch creation has two parents: one at

  • git-svn merges and commit details 2008-09-24

    we are using git-svn to manage branches of an SVN repo. We are facing the following problem: after a number of commits by user X in the branch, user Y would like to use git-svn to merge the changes in branch to trunk. The problem we're seeing is that

  • How do I make git-svn use a particular svn branch as the remote repository? 2008-10-10

    A word of warning: I'm a n00b to git in general. My team uses feature branches in svn, and I'd like to use git-svn to track my work on a particular feature branch. I've been (roughly) following Andy Delcambre's post to set up my local git repo, but t

  • git-svn: what's the equivalent to `svn switch --relocate`? 2008-11-06

    An svn repository I'm mirroring through git-svn has changed URL. In vanilla svn you'd just do svn switch --relocate old_url_base new_url_base. How can I do this using git-svn? Simply changing the svn url in the config file fails. --------------Soluti

  • How do I tell git-svn about a remote branch created after I fetched the repo? 2008-11-17

    I'm using git-svn to work against my company's central svn repository. We've recently created a new feature branch in the central repo. How do I tell git about it? When I run git branch -r I can only see the branches that existed when I ran fetch aga

  • Git Svn dcommit error - restart the commit 2009-03-10

    Last week, I made a number of changes to my local branch before leaving town for the weekend. This morning I wanted to dcommit all of those changes to the company's Svn repository, but I get a merge conflict in one file: Merge conflict during commit:

  • How to dcommit only selected patches with git svn? 2009-06-10

    I have a number of locally committed patches in my git-svn repo which I haven't yet commited to our svn repo. A normal "git svn dcommit" will commit all of these patches to svn. I would like to commit only some of my patches (simple bug fixes), but n

Copyright (C), All Rights Reserved.

processed in 0.144 (s). 11 q(s)