Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

git cannot apply binary patch *** without full index line

When I try to apply a patch from a file, I see

error: cannot apply binary patch to 'my/resource.png' without full index line
error: my/resource.png: patch does not apply

I added my/resource.png in the commit from which I made the patch. How can I enabled full-index support?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Checkout the branch from which you want to create the patch. Run this command:

git diff-index 79fd4d7 --binary > ~/Desktop/my-patch

Where 79fd4d7 is a placeholder for the commit that came right before the range of commits you want to diff. (e.g. I want a patch that contains the first three commits below:

aaa02b0 third commit mine
aabbbcc second commit mine
bb82aed first commit mine
79fd4d7 old commit

Then checkout your new branch and run git apply ~/Desktop/my-patch


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...