Suppose I have this folder structure:
/projectroot/foo/bar/subfoo/foo.txt
Now I change something in foo.txt a make a commit.
I have another repository with the exact same foo.txt but the folder structure is like this:
/projectroot/somedir/foo.txt
It’s obvious that there should be a way to automatically apply the work on foo.txt in the second repository. I guess one can create a patch but I fail to find the right way to do it. I somehow need to create a patch out of the commit that works only on the file (or relative to the parent directory) and then apply it only to the file or to the directory that hosts the file.
How can I do this with git?
The usual thing to do is to create the patch as usual and then to use the options
--directory(and maybe also-p) when applying the patch withgit applyorgit am.