【问题标题】:How to use x.diff.txt patch a project?如何使用 x.diff.txt 给项目打补丁?
【发布时间】:2018-01-08 01:10:53
【问题描述】:

我在 tmux https://github.com/tmux/tmux/issues/1225 上打开了一个问题

维护者告诉我的

试试这样的 x.diff.txt 然后显示来自 -vvvv 的 tmux 日志

x.diff.txt 是:https://github.com/tmux/tmux/files/1609045/x.diff.txt

它看起来像 git diff。我认为这是一种补丁,但是我如何将这个文件应用到整个项目中呢?我只使用 tortoisegit 来解决冲突。

【问题讨论】:

  • 你试过git apply吗?
  • 你标记C是因为?
  • @Ajay Brahmakshatriya tmux 是 c,我认为可能与 c make tool 有关。
  • How to apply a patch的可能重复
  • 这可能是“如何应用补丁”的副本,但它对我仍然有用,因为我也发生了完全相同的事情(tmux 维护者给了我 x.diff.txt on我的GH问题)。我知道这是一个补丁,但从扩展名和文件的前面部分都看不出我应该如何使用它,或者搜索什么,所以我用谷歌搜索“如何应用 x.diff”并在这里结束.

标签: git patch


【解决方案1】:

git apply学习https://www.devroom.io/2009/10/26/how-to-create-and-apply-a-patch-with-git/

我的问题

git clone https://github.com/tmux/tmux

cp x.diff.txt tmux & cd tmux

# take a look at what changes are in the patch
git apply --stat x.diff.txt

# test the patch before you actually apply it, no output means fine
git apply --check x.diff.txt

# If you don't own the project 
git apply x.diff.txt 

# If you own the project 
git am x.diff.txt 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-28
    • 1970-01-01
    • 2020-01-14
    相关资源
    最近更新 更多