How can I apply a patch in my location repository in git?
I tried $ git am < 0001-Add-Voicemail-tab-to-Contacts.patch Patch does not have a valid e-mail address.
I tried $git apply 0001-my.patch
but I get fatal: git diff header lacks filename information (line 27) where line 27 is "GIT binary patch" in my patch file. My patch file has an png in it.
this is line 24 and on
diff --git a/res/drawable-finger/icl.png b/res/drawable-finger/icl.png
new file mode 100644
index 0000000000000000000000000000000000000000..f78e65cf94d22059e0caeb90caee03e17166f109
GIT binary patch
literal 1697
zcmV;S244AzP)<h;3K|Lk000e1NJLTq001BW001Be1^@s6b9#F80000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU&LrFwIRCwCNS6ygRXBd9-pOdCZnl?Wr
zT}!*JMXxLc!LeIm!`%pu!FDwmis0~S-pnf*2)mHMWH7G;(JNtBW1={AA=C-BqUf{=
GIT patch or GIT diff is used to share the changes made by you to others without pushing it to main branch of the repository. This way other people can check your changes from the GIT patch file you made and suggest the necessary corrections.
A patch is a text file whose contents are similar to Git diff but along with code it contains metadata about commits, for example, a patch file will include commit ID, date, commit message, etc. We can create a patch from commits and other people can apply them to their repository.
I was able to reproduce your problem by faking an end-of-line problem.
$ cp /bin/ls .
$ git add ls; git commit -m second
[master 8668716] second
1 files changed, 0 insertions(+), 0 deletions(-)
create mode 100755 ls
$ git format-patch HEAD^..HEAD
0001-second.patch
$ git reset --hard HEAD^
HEAD is now at 686ace7 first
$ unix2dos 0001-second.patch
$ git apply 0001-second.patch
fatal: git diff header lacks filename information (line 14)
Assuming you're running Linux, try
$ dos2unix 0001-Add-Voicemail-tab-to-Contacts.patch
$ git apply !$
If you're running Cygwin, perform the opposite conversion:
$ unix2dos 0001-Add-Voicemail-tab-to-Contacts.patch
$ git apply !$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With