来自外部 .diff 文件的交互式补丁 [英] Interactive patch from external .diff file

查看:80
本文介绍了来自外部 .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 文件的交互式补丁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆