How to apply a patch in Git that contains changes to the file name?

I created a patch that consists of changing the file name:

git mv -f confvars.sh ConfVars.sh
git commit -am 'test filename case change'
git format-patch -M -1 HEAD

but when I try to apply this patch, I get an error message:

git apply 0001-test-filename-case-change.patch
> error: ConfVars.sh: already exists in working directory

How can I apply this patch without causing an error?

** EDIT **

To clarify the above example: when applying the patch, the ConfVars.sh file does not exist, the confvars.sh file exists, which I would expect to rename, instead it displays the above error.

+3
source share
1 answer

, -, git-apply, , , . , , , . ( -M git-format-patch .)

, , :

  • , , .
  • , , (, TEMPORARY-FILE-CHANGE-ME),
  • , - , .
+1

All Articles