Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove subversion remote in git?

Tags:

git

git-svn

I have a git repository that was originally created using git-svn. Now I have a git server that I push to and the svn repository has been lost. Can I remove the svn remote? How?

like image 237
jlconlin Avatar asked Aug 17 '12 22:08

jlconlin


People also ask

What is git SVN command?

What is Git-SVN? The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

Can I use Git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.

What does Git SVN fetch do?

This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches :) You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.


2 Answers

You can edit the .git/config file and remove the section associated with the remote you want to remove.

The lines you want to remove probably look roughly like this:

[svn-remote "svn"]     url = url-of-svn-repository/trunk     fetch = :refs/remotes/git-svn 

This will remove the remote from Git, but you will still have the relationship between the Git commits and the SVN commits stored in .git/svn. You can remove this whole directory if you want to get rid of all your SVN remotes. If you want to get rid of just one SVN remote and keep others, you will need to look at the directory structure and only remove the ones associated with the remote you are removing.

like image 130
Eric Avatar answered Sep 17 '22 13:09

Eric


Doing it via most *nix shells, bash or mingw32:

cd ~/your_repo git config --remove-section svn 

or whatever section you have when you view the config (cat .git/config). For example, the next line would remove the same config section described in Eric's solution:

git config --remove-section svn-remote.svn 

next remove all svn stuff inside the .git folder (svn, logs, and refs). Which is also what Sergey suggests.

rm -rf .git/svn .git/{logs/,}refs/remotes/{git-,}svn/ 

garbage collection just for good measure:

git gc 

source/credits

like image 45
Anthony Hatzopoulos Avatar answered Sep 18 '22 13:09

Anthony Hatzopoulos