Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6368603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:41:48+00:00 2026-05-25T00:41:48+00:00

A project in SVN I’m working on (via git-svn) has frequently-created branches that are

  • 0

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.

I can remove these one at a time, checking whether they still exist in the svn repository but it’s slow and tedious. Is there a way to sync my list of git remote branches with the svn repo?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:41:49+00:00Added an answer on May 25, 2026 at 12:41 am

    This is a quick-n-dirty solution I made in a few minutes. It makes use of nice regex patterns that are not available everywhere.

    This grabs a clean list of branches. I remove formatting spaces at the beginning of each line, and I’m ignoring tags for now:

    git branch -r | sed 's|^[[:space:]]*||' | grep -v '^tags/' > git-branch-list
    

    I grab a similar list of branches from svn, again removing formatting and trailing forward-slashes:

    svn ls svn://path/to/branch/dir/ | sed 's|^[[:space:]]*||' | sed 's|/$||' > svn-branch-list
    

    I diff the lists, find the lines that don’t exist in the svn list anymore, remove the diff formatting, get rid of the “trunk” branch (which is a git-svn convenience) and save the results to a new list:

    diff -u git-branch-list svn-branch-list | grep '^-' | sed 's|^-||' | grep -v '^trunk$' | grep -v '^--' > old-branch-list
    

    Now I just perform standard branch removal procedures for git-svn:

    for i in `cat old-branch-list`; do git branch -d -r "$i"; rm -rf .git/svn/refs/remotes/"$i"; done
    

    There’s probably better ways of doing this, but it works. Someone else is welcome to take this and improve on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an svn project that also has several plugins in vendor/plugins - all
Let's say I have checkedout a project via SVN, then I right clicked the
In our git-svn managed project, we have 3 upstream projects that are all kept
I have a project in SVN that I'm migrating to Git. The project consists
I have tried to convert an SVN project to Mercurial using svnsync and then:
I am taking an existing project in svn. importing it into eclipse. then disconnecting
I want that everytime someone wants to checkout the project from SVN he/she will
My scenario is such that I have a VB.NET project in SVN and I
Error message : svn: Can't open file '/Users/username/Projects/myproject/trunk/project/.svn/text-base/filetoupdate.h.svn-base': No such file or directory Question:
I have an SVN project with a branch I'm working on, and an empty

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.