如何为新文件创建补丁?
我知道为现有文件创建补丁很容易:
diff -aru oldFile newFile 2>&1 | tee myPatch.patch
但是,如果我想为全新文件创建补丁,该怎么办?假设我的文件位于名为 TestDir
的文件夹中。早期的 TestDir
没有名为 entirelyNewfile.c
的文件,但现在有了相同的文件。
如何为entirelyNewfile.c
创建补丁?这个想法是,补丁应该正确应用到规范并生成 RPM 版本。 BUILD 目录有这个新文件。
只是补充一下:如果我尝试在两个目录之间进行比较(一个目录包含新文件,另一个目录缺少相同文件)来创建补丁,则会生成一条错误,指出该文件仅存在于一个文件夹中
I know to create a patch for an existing file is easy:
diff -aru oldFile newFile 2>&1 | tee myPatch.patch
But what to do, if i want to create a patch for a totally new file? Assume my file is residing in a folder called TestDir
. Earlier TestDir
did not have a file called entirelyNewfile.c
, but now it is having the same.
How to create a patch for entirelyNewfile.c
? The idea is, the patch should get properly applied to the specs and generate the RPM build. With BUILD dir having this new file.
Just to add: if i try to take diff between the two directories, one having the new file and the other missing the same, to create the patch, it generates an error saying that file is only present in one folder
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
将
-N
添加到diff
参数中。Add
-N
to thediff
arguments.将为您的新文件创建一个补丁。
Will create a patch for your newfile.
据我所知,最简单的方法是将所有文件置于版本控制之下(如果还没有的话)。我更喜欢 Git,但类似的事情可以在任何其他版本控制系统中完成:
The easiest way to do this that I know is to put all the files under version control (if they aren't already). I prefer Git, but something similar could be done in any other version control system: