Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change ignore-paths on an existing git-svn repo?

Tags:

git-svn

I have an already existing git-svn repo with an ignore paths in my .config file that looks like this:

ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3))

This works well.

Someone added a new project in svn that I now need in my git repo.

If I change ignore-paths to what's below and issue a fetch or a rebase, I never see Path2/Proj4

 ignore-paths = ^(?!(Path1/Proj1|Path1/Proj2|Path2/Proj3|Path2/Proj4))

In the past, I've always given up and blasted away my git repo and recreated it. Is there a better way?

like image 790
joe Avatar asked Sep 25 '12 18:09

joe


People also ask

Can I use Git and SVN at the same time?

You can clone a subversion repository to your machine using git svn clone <SVN repo URL> . The code will be available as a git repository. You can do your work there and make local commits as you please. There is a command line option to get a "shallow" checkout rather than the entire repository which is often useful.

How do I clone a SVN repository?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...


1 Answers

After editing the ignore-paths you need to

git svn reset -r <n> -p # where <n> is the SVN revision where the new path was added.
git svn fetch
git rebase # or reset

Reference git-svn(1):

reset

Undoes the effects of fetch back to the specified revision. This allows you to re-fetch an SVN revision. Normally the contents of an SVN revision should never change and reset should not be necessary. However, if SVN permissions change, or if you alter your --ignore-paths option, a fetch may fail with "not found in commit" (file not previously visible) or "checksum mismatch" (missed a modification). If the problem file cannot be ignored forever (with --ignore-paths) the only way to repair the repo is to use reset.

Only the rev_map and refs/remotes/git-svn are changed (see $GIT_DIR/svn/*\*/.rev_map.* in the FILES section below for details). Follow reset with a fetch and then git reset or git rebase to move local branches onto the new tree.

like image 90
npostavs Avatar answered Nov 02 '22 07:11

npostavs