svn2git with --exclude,有什么方法可以忽略空/空白提交吗?

发布于 2024-11-29 22:49:26 字数 431 浏览 5 评论 0原文

我正在将一个大型 SVN 存储库转换为多个 git 存储库(每个项目一个)。

我正在为每个存储库运行 svn2git ,其中包含所有不需要的目录--excluded,这可以很好地保留标签和分支(我在转换后删除所有不相关的标签和分支)

唯一的问题是我有大量空提交(与排除的目录相关的提交)。

有没有办法在 svn2git 过程中排除这些空提交?

这个解决方案是一个很好的方法事后删除它们,但 filter-branch 仅影响当前分支,而不影响所有其他分支和标签。

I'm converting a big SVN repository into multiple git repositories (one for each project).

I am running svn2git for each repo with all unwanted directories --excluded this works well to keep the tags and branches (I delete all the unrelated tags & branches after the conversion)

The only problem is I have loads of empty commits (commits relating to the excluded directories).

Is there any way to exclude these empty commits during the svn2git process?

This solution is a fine way to remove them after the fact, but filter-branch only affects the current branch, and not all the other branches and tags.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧情勿念 2024-12-06 22:49:26

解决了。

据我所知,此命令将重写历史记录,删除空白提交,但保留其他所有内容。

git filter-branch --tag-name-filter cat --prune-empty -- --all

您可以使用此命令查询前后的提交次数作为快速测试:

git log --pretty=格式:'' | wc -l <​​/code>

Worked it out.

To the best of my knowledge, this command will rewrite the history, removing the blank commits, but preserving everything else.

git filter-branch --tag-name-filter cat --prune-empty -- --all

You can use this command to query the number of commits before and after as a quick test:

git log --pretty=format:'' | wc -l

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文