来自外部 .diff 文件的交互式补丁

编程入门 行业动态 更新时间:2024-10-23 18:21:12
本文介绍了来自外部 .diff 文件的交互式补丁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有适用于 Linux 的命令或程序允许以交互方式修补源代码、在屏幕上打印每个块并在将其应用到文件之前等待确认?

Is there a command or program for Linux that allows to patch the source code interactively, printing every chunk on the screen and waiting for acknowledgement before applying it to the file?

类似于 git add -p,但从另一个 .diff 文件中获取更改?

Something like git add -p, but taking the changes from another .diff file?

推荐答案

您始终可以在 shell/ruby/python 中编写脚本,逐行读取该文件并提示在文件签名之间添加差异.

You can always write script in shell/ruby/python that reads that file line by line and prompts adding diff between file signatures.

它可以接受 diff 文件的名称作为参数,或者您可以在脚本中放置两个哈希值并制作补丁.

It can accept name of diff file as parameter or you can put two hashes and make a patch inside a script.

更多这样你就可以调用该脚本 git-command-name,把它放在你的 user/bin 文件夹中,git 会将 command-name 识别为 git 命令.

More so you can call that script git-command-name, put it in your user/bin folder and git will recognise command-name as git command.

另一方面(只是一个想法)你能操纵 .diff 的创建吗?也许您可以使用格式补丁并在每次提交差异后应用停止?

On the other hand (just an idea) can you manipulate creation of .diff ? Maybe you can use format-patch and on applying stop after every commit diff?

更多推荐

来自外部 .diff 文件的交互式补丁

本文发布于:2023-11-10 00:59:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573928.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:补丁   文件   diff

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!