git - 如何应用 Git 补丁文件中的特定文件?

标签 git

我有一个包含 6 个文件的 Git 补丁。

  1. abc.php
  2. pqr.php
  3. zyz.php
  4. rrr.php
  5. ggg.php
  6. yyy.php

我只想应用包含上述文件的 .patch 文件中的 rrr.php

git-apply 命令包含一个 --exclude 参数,但不包含 --include

如何只应用 .patch 文件中的 rrr.php?

最佳答案

你说:

git-apply command includes an --exclude arg, but not --include

git-apply (1) Manual Page说:

--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/

相关文章:

git - 如何使用带有 ssh 的 java api 推送到 gitlab

c# - 从 C# 运行 PowerShell 脚本以 pull Git 存储库

git - 同一台机器上的多个 Git 用户

Git/GitHub : fork, 子树 merge 或外部代码的子模块?

windows - 打开 git bash shell 窗口,执行命令并在 term 信号后保持

git - "git pull"如何从master进入开发分支

git - 选择要与 Git 一起使用的私钥

android - 特 pull 维斯 VS CircleCi VS Jenkins

python - 为什么我的github上的python包没有显示使用的信息?

windows - 适用于直接访问的 Windows 的 Git 克隆