使用 reposurgeon 将 svn repo 转换为 Git 时如何跳过前 N 次提交?
How to skip first N commits when converting svn repo to Git using reposurgeon?
使用 reposurgeon 将 subversion 存储库转换为 Git 时,如何跳过前两次提交?
第一次 svn 提交使用错误的分支布局导入代码(trunk
、tags
、branches
),第二次提交删除了所有代码。
第三次提交是对正确分支布局的导入(subdir/trunk
、subdir/tags
、subdir/branches
)。
这个错误的开始似乎让 reposurgeon 感到困惑,因为生成的 Git 存储库只有一个提交:最初的错误开始。所有后来的提交都将被忽略。
这是我尝试过的:
# installed reposurgeon 3.29
mkdir foo
cd foo
repotool initialize foo svn git
# edited the Makefile and set REMOTE_URL
make stubmap
# edited the resulting authors map (foo.map)
echo "1..2 delete" >>foo.lift
make
我不熟悉 reposurgeon
bot 如果您从命令行克隆,您可以指定您希望克隆的提交数 + 您希望克隆的分支名称。
// Clona last X commits of branchA
git clone ... --depth=X --branch=branchA
现在您可以将此存储库添加到您的 reposurgeon
服务器
使用以下命令删除前两个 svn 提交:
<1>..<2> delete
这一行表示"select the commits from legacy ID 1
to legacy ID 2
(inclusive) and delete them"。或者,您可以使用以下语法:
<#1>..<#2> delete
这意味着 "select the commits from the first commit to the second (inclusive) and delete them"。此语法适用于 non-svn 个输入存储库。小心——提交 #2 可能不是提交 #1 的子提交(例如,它们可能是来自 Git 存储库的两个根提交)。
即1..2
select或"select the events from the first to the second (inclusive) and delete them"。事件与提交不同——事件包括 blob(文件)、标记、重置等。因为 blob 事件必须出现在引用它们的提交之前,所以 1..2
很可能是 select blob,而不是提交。
使用 reposurgeon 将 subversion 存储库转换为 Git 时,如何跳过前两次提交?
第一次 svn 提交使用错误的分支布局导入代码(trunk
、tags
、branches
),第二次提交删除了所有代码。
第三次提交是对正确分支布局的导入(subdir/trunk
、subdir/tags
、subdir/branches
)。
这个错误的开始似乎让 reposurgeon 感到困惑,因为生成的 Git 存储库只有一个提交:最初的错误开始。所有后来的提交都将被忽略。
这是我尝试过的:
# installed reposurgeon 3.29
mkdir foo
cd foo
repotool initialize foo svn git
# edited the Makefile and set REMOTE_URL
make stubmap
# edited the resulting authors map (foo.map)
echo "1..2 delete" >>foo.lift
make
我不熟悉 reposurgeon
bot 如果您从命令行克隆,您可以指定您希望克隆的提交数 + 您希望克隆的分支名称。
// Clona last X commits of branchA
git clone ... --depth=X --branch=branchA
现在您可以将此存储库添加到您的 reposurgeon
服务器
使用以下命令删除前两个 svn 提交:
<1>..<2> delete
这一行表示"select the commits from legacy ID 1
to legacy ID 2
(inclusive) and delete them"。或者,您可以使用以下语法:
<#1>..<#2> delete
这意味着 "select the commits from the first commit to the second (inclusive) and delete them"。此语法适用于 non-svn 个输入存储库。小心——提交 #2 可能不是提交 #1 的子提交(例如,它们可能是来自 Git 存储库的两个根提交)。
即1..2
select或"select the events from the first to the second (inclusive) and delete them"。事件与提交不同——事件包括 blob(文件)、标记、重置等。因为 blob 事件必须出现在引用它们的提交之前,所以 1..2
很可能是 select blob,而不是提交。