Cherry-picking changes from a file to a different file

I have a file.
I have another file on a different path on a different branch with mostly the same content.
I have changes in my first file.
I want to move these changes to my second file.
The files have the same name, only the path differs.
(I also need to ignore changes in whitespace, because consistency.)

Solution:

git show SHA_HASH --relative=original/path/ -- original//path/file.name | git apply --directory=new/path/ --ignore-space-change -

Leave a Reply

Your email address will not be published. Required fields are marked *