git : empty ident name (for <>) not allowed

前端 未结 4 2043
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 08:07

I was applying a diff file of an opensource project on the top of my repository using git-am :

 git am -3 < /Downloads/refactorWork.diff

but

相关标签:
4条回答
  • 2021-02-02 08:12

    Moved out of comment to the accepted answer

    When you click "Save unified diff" in TortoiseGit, you must right-click the created .diff or .patch file and select TortiseGit→Review/apply single patch instead of Apply Patch Serial....

    Put the diff file in the root of the folder to which files you want to apply the patch to, first.

    0 讨论(0)
  • 2021-02-02 08:22

    I had a patch that looked perfectly fine, including a commit message, Author: header, etc.

    I compared the output of git-format-patch, and noticed it used From: headers instead of Author: headers.

    Sure enough, if you change Author: to From:, git-am applies the change cleanly.

    0 讨论(0)
  • 2021-02-02 08:28

    Use,

    git apply -3 patchName.patch

    when you encounter conflicts, open your mergtool and resolve conflicts

    git mergetool

    that's all :)

    0 讨论(0)
  • 2021-02-02 08:33

    This diff file is a plain diff, not something generated by git format-patch. A format-patch generated diff contains information about the commit author, author date, commit message, ... and maintains this information when creating the commit(s).

    Your plain diff does not have these information, so git am will complain that it is missing naturally.

    You should instead have used git apply which is meant to apply simple patch files like you have in this case which will only apply the patch to the worktree (and index if you tell it to) but does not create any commit automatically.

    0 讨论(0)
提交回复
热议问题