Я намагаюся перенести кілька комітів з одного проекту на другий, подібний, за допомогою git.
Тож я створив патч, що містить 5 комітів:
git format-patch 4af51 --stdout > changes.patch
Потім перемістіть патч у папку другого проекту та захочете застосувати патч:
git am changes.patch
... але це видає мені помилку:
Applying: Fixed products ordering in order summary.
error: patch failed: index.php:17
error: index.php: patch does not apply
Patch failed at 0001 Fixed products ordering in order summary.
The copy of the patch that failed is found in:
c:/.../project2/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Тож я відкрив index.php, але там нічого не змінилося. Я припускаю, що деякі >>>>>>>позначки тощо, наприклад, при вирішенні конфлікту злиття, але у файлі не було позначено жодного конфлікту. git statusдав мені також порожній список змінених файлів (тільки changes.patchтам був). Тож я запускаю git am --continue, але з’являється ще одна помилка:
Applying: Fixed products ordering in order summary.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Я використовую Windows 7 і найновішу версію git "1.9.4.msysgit.1"
PS Після кількох годин гуглиння я знайшов кілька рішень, але мені нічого не вдається:
git am -3 changes.patch
видає дивну помилку "інформація sha1":
Applying: Fixed products ordering in order summary.
fatal: sha1 information is lacking or useless (index.php).
Repository lacks necessary blobs to fall back on 3-way merge.
Cannot fall back to three-way merge.
Patch failed at 0001 Fixed products ordering in order summary.
The copy of the patch that failed is found in:
c:/.../project2/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
git am changes.patch --ignore-whitespace --no-scissors --ignore-space-change
видає першу помилку, як зазначено вище: "помилка: помилка виправлення: index.php: 17", але ніяких позначок конфлікту в не index.phpбуло додано.