में एक पैच लागू मैं एक उथले क्लोन, जिस पर मैं तीन प्रतिबद्ध बनाया है।
के दौरान त्रुटि Git
$ git log --oneline --graph --decorate --all
* d3456fd (HEAD, master) patch 3
* 9713822 patch 2
* 6f380a6 patch 1
* 8a1ce1e (origin/master, origin/HEAD) from full clone
* 7c13416 added from shallow
* 3b3ed39 removed email
* cfbed6c further modifications
* a71254b added for release 2.1
* 7347896 (grafted) changes for release 2
अब मैं यहाँ से एक पैच बनाने के लिए:: यहाँ लॉग है
$ git format-patch -k --stdout origin > ../format_since_origin.patch
मैं एक और क्लोन, जो एक पूर्ण क्लोन है में इस पैच लागू करना चाहते हैं।
$ git log --oneline --graph --decorate --all
* 8a1ce1e (HEAD, origin/master, master) from full clone
* 7c13416 added from shallow
* 3b3ed39 removed email
* cfbed6c further modifications
* a71254b added for release 2.1
* 7347896 changes for release 2
* b1a8797 changes to ttwo files
* 603710c changed test report
* 16b20b3 added test_report.txt
* f0871ea modified file1.xml
* dd94bfc added file1.xml
* 00758aa second commit
* 49f9968 first commit
मैं ऊपर उथले क्लोन से बनाए गए पैच लागू करने में असमर्थ हूँ:
यहाँ लॉग है। मुझे निम्नलिखित त्रुटि मिलती है।
$ git am -3 /c/temp/git/format_since_origin.patch
Applying: patch 1
Using index info to reconstruct a base tree...
error: patch failed: file1.c:6
error: file1.c: patch does not apply
Did you hand edit your patch?
It does not apply to blobs recorded in its index.
Cannot fall back to three-way merge.
Patch failed at 0001 patch 1
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
कोई विचार क्यों यह पैच विफल हो रहा है? या मेरी विधि पूरी तरह से गलत है?
अद्यतन:
यह के रूप में चार्ल्स ने सुझाव दिया है, तो निम्न
$ git am -3 --ignore-whitespace /c/temp/git/format_since_origin.patch Applying: patch 1 Applying: patch 2 Applying: patch 3
अब साथ काम करता है - अगर मैं Git diff की कोशिश, मैं नीचे के रूप में त्रुटि मिलती है।
$ git diff -p origin > ../dif_origin.patch
लागू करने पर,
$ git apply --ignore-whitespace --inaccurate-eof /c/temp/git/dif_origin.patch
c:/temp/git/dif_origin.patch:9: trailing whitespace.
patch change for file1.c
c:/temp/git/dif_origin.patch:18: trailing whitespace.
patch this xml guy
c:/temp/git/dif_origin.patch:29: trailing whitespace.
fsdfsd
c:/temp/git/dif_origin.patch:30: trailing whitespace.
patch this report
error: patch failed: file1.c:6
error: file1.c: patch does not apply
error: patch failed: file1.xml:2
error: file1.xml: patch does not apply
error: patch failed: tr/test_report.txt:2
error: tr/test_report.txt: patch does not apply
क्या कोई कारण नहीं है कि 'गिट बंडल' या यहां तक कि 'गिट diff'/'git apply' का उपयोग न करें? –
@charles, मुझे गिट diff का उपयोग करने और लागू करने पर त्रुटियां मिलती हैं। मैंने मूल पोस्ट में त्रुटि विवरण जोड़ा है। क्या मैंने अंतर गलत बनाया? – maxmelbin