大量 git 提交被压缩
我的公司正在从 CVS 转换到 git。我们使用 CVS 已经很长时间了,因此有着悠久的历史。手工要做的事情太多了。
查看日志,可以进行很多压缩。一大堆。我想做的是挂钩一个脚本来比较两个相邻的提交。如果返回 true,则连接提交消息并压缩提交。我也很高兴有一个命令接受两个提交和一个提交消息,然后将它们压缩在一起。
git rebase --interactive 接近我需要的,但是“squash”需要太多的手动干预。我还考虑使用“fixup”而不是squash,但我不想丢失提交消息。
有什么想法吗?
My company is in the middle of converting from CVS over to git. We've been on CVS for a long time, so there is a huge history. Too much to do by hand.
Looking at the logs, there is a lot of squashing that could be done. A whole lot. What I would like to do is hook in a script that will compare two adjacent commits. If it returns true, then concatenate the commit messages and squash the commits. I would also be happy with a command that accepts two commits and a commit message, then squashes them together.
git rebase --interactive is close to what I need, but "squash" requires far too much manual intervention. I also looked at using "fixup" instead of squash, but I don't want to lose the commit messages.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样——自动挤压?
您可以将其与 git filter-branch 结合起来以脚本重命名提交。 (不过,有一句警告。要小心过滤器分支,并阅读其手册页中的警告。这不是一个适合胆小的人的命令。)
How about --autosquash?
You could combine it with git filter-branch to script renaming the commits. (A word of warning, though. Be careful with filter branch, and read the warnings in its man page. It's not a command for the faint of heart.)