通过 diff & 添加完整目录修补

发布于 2024-09-30 08:14:20 字数 126 浏览 1 评论 0原文

是否可以通过 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 技术交流群。

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

发布评论

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

评论(3

泪冰清 2024-10-07 08:14:21

回答我自己:

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.

情魔剑神 2024-10-07 08:14:21

两个快速建议 - 这些应该会有所帮助

  1. 您需要标志 -r | --recursive

  2. 您可能还需要 --uni Direction-new-file-N | --new-file

因为我在这里已经做了你想做的事。

Two quick suggestions--these should help

  1. You need the flag -r | --recursive

  2. You probably also need --unidirectional-new-file or -N | --new-file.

as I have done what you have in mind here.

乱了心跳 2024-10-07 08:14:21

以下步骤将起作用

  1. 在旧源代码和新源代码之间打补丁(新文件+新目录)
    diff -urPp old_src new_src >新补丁
     
  2. 创建临时目录
    mkdir 温度
     
  3. 将原来的旧源代码目录复制到临时目录
    cp -r old_src 临时
     
  4. 将补丁文件复制到创建的临时目录
    cp 新补丁温度
     
  5. 改变目录
    光盘温度
     
  6. 应用补丁
    补丁-p0 <新补丁
     

现在所有补丁都将通过文件更改+新文件+临时目录中的目录添加来应用

Below steps will work

  1. Taking patch between the old source code and new source code (new files + new directories)
    diff -urPp old_src new_src > new.patch  
  2. create a temp directory
    mkdir temp  
  3. copy the original old source code directory to temp directory
    cp -r old_src temp  
  4. copy the patch file to temp directory created
    cp new.patch temp  
  5. change directory
    cd temp  
  6. apply patch
    patch -p0 < new.patch  

Now all the patches would be applied with file changes + new files + directory addition in the temp directory

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