git create patch with diff

后端 未结 4 1926
慢半拍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 14:17

    Try a:

    git apply --ignore-space-change --ignore-whitespace patch.diff
    

    As mentioned in "git: patch does not apply", this can be caused by:

    • the line endings differing between the local file system and the remote repo.
      User core.eol in .gitattributes file is a good approach (see "git force file encoding on commit")
    • the execution bit ('x').
      That can lead you to set git config core.filemode false, followed by a git reset --hard HEAD (make sure you don't have uncommitted changes, or they would be lost).

提交回复
热议问题