I'm trying to use git format-patch -> git am to port commits between two repositories In the source repository, the files are in the root directory of the repository (./file) In the destination repository, the files are in a sub-directory (./dir/file). The --src-prefix and --dst-prefix seem to be the perfect tool for the job of getting the patch stream output by format-patch to have the right format to apply in the destination repository. Like so: git format-patch -N -p --src-prefix=a/dir/ --dst-prefix=/b/dir/ -o ../xfer.1 and then in the destination. git am ../xfer.1 But in the resulting diff's in addition to the requested prefix changes, there were also 'deleted file mode 100644' lines added. It's subtle, but I now realize this was because of a typo (vs my intent) in the above command. The --dst-prefix starts with a slash "/" not "b/dir/" as I intended. So I think I stumbled into a problem with the builtin_diff code here: https://git.kernel.org/pub/scm/git/git.git/tree/diff.c?id=eab9a40b6dd5c1c571b1deb264133db47bb4794d#n1216 It uses the short-hand of testing just the first character of lbl[0] and lbl[1] to decide if the source is /dev/null or the destination is /dev/null to print "new file" or "deleted file" lines. But with src-prefix and dst-prefix, those lines could be triggered incorrectly with a prefix that begins with / which might have a legitimate reason for others to do. I'm new to git development, but I'm willing to try and work up a patch if this is a valid issue and someone can help guide me through the submission process. Thanks, Phil P.