git-svn - 如何更改现有 git-svn 存储库上的忽略路径?

标签 git-svn

我已经有一个现有的 git-svn 存储库,其 .config 文件中的忽略路径如下所示:

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

这很有效。

有人在 svn 中添加了一个新项目,我现在在 git 存储库中需要它。

如果我将忽略路径更改为下面的内容并发出获取或 rebase ,我永远不会看到 Path2/Proj4

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

过去,我总是放弃并删除我的 git 存储库并重新创建它。有更好的办法吗?

最佳答案

编辑忽略路径后,您需要

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

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

关于git-svn - 如何更改现有 git-svn 存储库上的忽略路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12588564/

相关文章:

git-svn 克隆失败 "fatal: Not a valid object name"

git 和 git-svn 和多个分支以及推送和获取

svn - git-svn:从非主分支恢复提交

git - 缺少分支使用 git-svn clone 克隆非标准 svn 存储库

git - 拆分文件时保留 git 历史记录

git:svn不是git命令-Mac

git svn clone > git svn rebase > 无法从工作树历史记录中确定上游 SVN 信息

git - git pull --rebase、git rebase 和 git merge 的区别

git - 如果我忘记在 merge 前执行 git svn rebase 怎么办?