git:不允许使用空ident标识(对于<>) [英] git : empty ident name (for <>) not allowed
问题描述
我正在使用git-am在我的资源库顶部应用一个开源项目的区别档案:
git am -3< /Downloads/refactorWork.diff
但它有冲突,我必须解决它们;但在解决冲突和分级后,当我做了git am - continueue我得到了:
致命:空ident名称for<>)不允许
我在互联网上查找并找到这似乎与我的问题类似,但我的用户名和电子邮件已添加在全球和本地git目录。这里是git config list的输出:
pre $ ro $ @ / Documents / libo:$ git config --global --list
user.email=rohankanojia420@gmail.com
user.name = Rohan Kumar
alias.l = log --oneline --graph --pretty
credential.helper = cache
尽管我通过首先提交阶段性更改并使用 git am --skip
,我很想知道这个错误是什么意思,以及我做的是否是正确的做法,或者有没有更好的办法?
这个diff文件是一个普通的diff,不是由 git format-patch
生成的。 format-patch
generated diff包含关于提交作者,作者日期,提交消息等信息,并在创建提交时维护这些信息。
您的普通差异没有这些信息,所以 git am
会抱怨它自然缺失。
您应该改为使用 git apply
,这是为了应用简单的修补程序文件,就像您在这种情况下只会应用修补程序到工作树(和索引,如果你告诉它),但不会自动创建任何提交。
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 it had conflicts and i had to resolve them; but after resolving the conflicts and staging them, when i did git am --continue i got :
fatal : empty ident name (for <>) not allowed
I looked up on the internet and found this which seemed to be similar to my problem but my usename and email were already added up in global and local git directories. Here is the output of git config list :
rohan@~/Documents/libo : $ git config --global --list
user.email=rohankanojia420@gmail.com
user.name=Rohan Kumar
alias.l=log --oneline --graph --pretty
credential.helper=cache
Although i solved this by first commiting the staged changes and then using git am --skip
, I am interested in knowing what does that error means and whether what i did was the correct way of doing it, or is there any better way?
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.
这篇关于git:不允许使用空ident标识(对于<>)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!