通过 diff & 添加完整目录修补
是否可以通过 diff 和 patch 添加完整目录?
这似乎是在标准代码库之上添加附加模块的非常方便的方法。
我用谷歌搜索了一些解决方案,但它们通常在文件级别工作,而不是目录级别。
谢谢。
Is it possible to add a full directory via diff and patch?
It seems as very convenient way to add additional modules on top of standard code-base.
I googled for some solutions, but they generally work on file level, not on directory level.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
回答我自己:
diff -urPp old_dir/ new_dir/ > new_module.patch
似乎可以解决问题。
Answering myself:
diff -urPp old_dir/ new_dir/ > new_module.patch
Seems to do the trick.
两个快速建议 - 这些应该会有所帮助
您需要标志
-r | --recursive
您可能还需要
--uni Direction-new-file
或-N | --new-file
。因为我在这里已经做了你想做的事。
Two quick suggestions--these should help
You need the flag
-r | --recursive
You probably also need
--unidirectional-new-file
or-N | --new-file
.as I have done what you have in mind here.
以下步骤将起作用
diff -urPp old_src new_src >新补丁
mkdir 温度
cp -r old_src 临时
cp 新补丁温度
光盘温度
补丁-p0 <新补丁
现在所有补丁都将通过文件更改+新文件+临时目录中的目录添加来应用
Below steps will work
diff -urPp old_src new_src > new.patch
mkdir temp
cp -r old_src temp
cp new.patch temp
cd temp
patch -p0 < new.patch
Now all the patches would be applied with file changes + new files + directory addition in the temp directory