Answer a question

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?

Answers

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.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐