git create patch with diff

后端 未结 4 1928
慢半拍i
慢半拍i 2021-02-01 13:32

I tried doing

git diff 13.1_dev sale_edit > patch.diff

Then I tried doing git apply patch.diff in another branch, but I got pa

4条回答
  •  一整个雨季
    2021-02-01 13:57

    With git version 1.9.1, I am seeing similar complaints when use 'git apply' to apply the patch created using 'git diff'.

    It seems 1.9.1 git is having problem dealing with mixture of spaces & tabs in the patch file.

    warning: squelched 1 whitespace error warning: 6 lines add whitespace errors.

    @VonC's answer does not help and I am still getting the same warnings.

    The easiest solution is to simply use the 'patch' command which successfully applies all changes captured in 'git diff' output to the target git directory.

    $ patch --version GNU patch 2.7.1

提交回复
热议问题