我有一个包含 6 个文件的 Git 补丁。
- abc.php
- pqr.php
- zyz.php
- rrr.php
- ggg.php
- yyy.php
我只想应用包含上述文件的 .patch
文件中的 rrr.php
git-apply
命令包含一个 --exclude
参数,但不包含 --include
。
如何只应用 .patch
文件中的 rrr.php?
最佳答案
你说:
git-apply
command includes an--exclude
arg, but not--include
--include=<path-pattern>
Apply changes to files matching the given path pattern. This can be useful when importing patchsets, where you want to include certain files or directories.
尝试:
git apply --include=rrr.php some.patch
已使用 Git 版本 1.8.4 验证。
关于git - 如何应用 Git 补丁文件中的特定文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20970388/