git 失败时尽可能应用补丁
我正在从一个存储库转移到另一个存储库,并且需要移植一些更改。目录结构大部分相同,但文件并不完全相同。
我使用“git format-patch”和“git am”或“git apply”来移植这些更改。当它工作时,生活是美好的,但是当它因为一些微小的更改或文件丢失而失败时,什么都不会应用。
我可以使用 --exclude 过滤掉文件,但我真正想要的是它尽可能地应用,并告诉我哪里存在冲突/失败。
我也愿意接受其他应用补丁或类似内容的选择。
I am moving from one repository to another and need to port some of the changes. The directory structure is mostly the same but the files not all identical.
I am using 'git format-patch' and 'git am' or 'git apply' to port those changes. When it works, life is good, but when it fails because of some minor change or files missing, nothing gets applied.
I can filter files out using --exclude, but what I really would like is that it applies as much as it can and just tell me where there are conflicts / failure.
I am also open to other option for applying the patches or things like that.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
--reject
选项可能就是您正在寻找的。这样,您将获得失败块的经典.rej
文件,而所有好的块都将被应用。The
--reject
option is probably what you're looking for. With that, you'll get classic.rej
files for failing chunks, while all the good chunks will be applied.您也可以尝试 git apply --3way 。
You could also try
git apply --3way
.