Generate a patch file beetwen two different branches in a specific folder

#generate a patch file beetwen two different branch in a specific folder inside
#pases_a_qa and incidents are branches
D:\mplescano\repositories\lineabase>git diff -U3  pases_a_qa:controlbienes2-insqui-recep-batch.ear incidents:controlbienes2-insqui-recep-batch.ear > d:\patch.txt
#git diff -U3  pases_a_qa:controlbienes2-operaciones.ear incidents:controlbienes2-operaciones.ear > d:\patch2.txt

git diff -U3 --diff-algorithm=patience  pases_a_qa:informix incidents:informix > d:\patch_4gl.txt
git diff -U960 --diff-algorithm=patience pases_a_qa:informix incidents:informix > d:\patch_4gl.txt

#git diff produces a patch file with mixed ending of LF and CRLF

#you have to apply this command in order to uniform the endings. But it doesn't work.Uses the notepad++ to convert them.Search a command line better than unix2dos
unix2dos d:\patch.txt

#apply a patch file
D:\mplescano\repositories\lineabase>patch --verbose --dry-run -p1 -d controlbienes2-insqui-recep-batch.ear -i d:\patch.txt
#patch --verbose -p1 -d controlbienes2-operaciones.ear -i d:\patch2.txt

patch --verbose -p1 -d informix -i d:\patch_4gl.txt

#With binary, patch respects now the ending line format
patch --binary --verbose -p1 -d informix -i d:\patch_4gl.txt

#for the command diff from the folder git
diff -x 'file01.txt' -x 'file02.ext' -N -r -U 7 path_folder_origin path_folder_destiny > path_file_to_generate_destiny.patch

diff -v 2.7 and 3.5 sometimes produce files in encoding utf-8 or iso-8859-1
That can result in a failure when you apply the patch command when patching a file in utf-8 by a patch file in iso-8859-1.
In this case use the iconv command:
iconv -f iso-8859-1 -t utf-8 file_source_iso-8859-1.patch > file_source_iso-8859-1.patch_utf8.patch
you can verify the encoding file by the command "file"
file -i file_source.patch

#ideal command to patch :P
patch --merge --binary -p8 --dry-run --verbose -d path_to_my_dir -i path_to_my.patch

#when you want a diff file before to commit your changes..
git diff -U7 --diff-algorithm=patience > path_to_your.patch

#Generate a patch file beetwen two commits
#avoid to use hash_commit^ because it seems doesn't work
git diff -U7 --diff-algorithm=patience ini_commit_hash~1..end_commit_hash > path_to_patch_file.patch