There was a commit for a particular file, at some point that needs to be reversed
I want to create a revert patch between that old commit with hash #A1B2C3D4:
folderA/file.c
...and the file in my working folder (on main branch):
folderB/folderC/file.c
The difficulty here, for me is that the file has been moved to another directory structure
how does one use git/diff/gittools/bc to generate such a reverse patch to a file that was moved?
I checked the doc, but git revert command does not seem to do what I want
thanks for your help
[edit]
I tried
git diff A1B2C3D4 HEAD -- folderA/file.c folderB/folderC/file.c
it returned
Similarity index 100%
rename from folderA/file.c
rename from folderB/folderC/file.c
You could checkout A1B2C3D4
, rename the file there to the name that you have now. Then you can compare the 2 commits that you care about to generate the patch
git checkout A1B2C3D4
git mv some-file some-file-new-path
git commit -m "Renamed file"
git diff the-other-commit -- some-file-new-path > some-patch-revert.patch
git diff HEAD the-other-commit -- some-file-new-path > some-patch.patch
Use the patch that best suits your needs.