我正在尝试从一个目录创建一个修补程序,并将该修补程序应用到不同的目录,前提是两个目录都包含相同的文件。
例如:考虑一下,回购1 /local/mnt/workspace/New_version/sample_dir/包含File1、File2和File3。
考虑一下,repo-2 /local/mnt/workspace/old_version/包含回购-1中提到的同一组文件.
现在,我正在尝试从repo-1创建一个修补程序集,并尝试将其应用到repo-2上,因为路径冲突会引发错误。
有什么办法能满足我的要求吗?请帮帮忙!
发布于 2017-11-13 12:57:24
为此,可以使用-p删除目录和--directory=<root>:
-p<n>
Remove <n> leading slashes from traditional diff paths. The default is 1.
--directory=<root>
Prepend <root> to all filenames. If a "-p" argument was also passed, it is applied before prepending the new root.
For example, a patch that talks about updating a/git-gui.sh to b/git-gui.sh can be applied to the file in the working tree modules/git-gui/git-gui.sh by running git apply --directory=modules/git-gui.https://stackoverflow.com/questions/47264829
复制相似问题