W
W
WH1T3_B0X2021-11-29 22:01:00
git
WH1T3_B0X, 2021-11-29 22:01:00

Can't apply a patch in GIT?

I have a patch that I want to apply.
Accordingly, I enter the command:
git am some-patch.patch
but instead of a successful application, I get:

error: main.py: already exists in index
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: some-patch
Patch failed at some-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".

I tried reverting the file, but it didn't work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2021-11-30
@WH1T3_B0X

error: main.py: already exists in index
This means that the patch is trying to create main.py, but it already exists in your project.
First delete the extra file, then continue to apply the patch:git am --continue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question