Get error message ''fatal: sha1 information is lacking or useless“ when apply a patch using ”git am -3"

后端 未结 6 1029
别那么骄傲
别那么骄傲 2020-12-17 08:53

I am trying to apply a series of patches from 1 git repository to another git repository using git am -3 \"path to a patch\". I apply them in order, from patch 1-4, it works

6条回答
  •  旧巷少年郎
    2020-12-17 09:05

    I have gotten similar conflicts, and an nth solution that worked for me was to:

    1. show the current patch failing to apply
    2. find the original commit hash/checksum/id
    3. go to the repository I am copying the patches from
    4. check out the commit before the one I failed to apply
    5. copy over the affected files as-is
    6. add the now changed files
    7. continue the applying process:
    new_repo> git am -3 /tmp/bunchopatches/*
    # 10: ERROR happens
    new_repo> git am --show-current-path | head -n 1
    # From fe89d2a53ccf30d068fdd5596a325f06b74ec4af Mon Sep 17 00:00:00 2001
    orig_repo> git checkout fe89d2a53ccf30d068fdd5596a325f06b74ec4af^
    orig_repo> cp aff/ected/files/* /new_repo/aff/ected/files/
    new_repo> git add aff/ected/files/*
    new_repo> git am --continue
    # rince and repeat (goto 10)
    

    (If you do the orig_repo> commands in a separate window this can actually be a rather quick process, just applied 80 patches with about 10 spacing conflicts this way=

提交回复
热议问题