2023-06-20 03:28 AM
Hello all.
I would like clarification about the structure of a patch file made with the "git diff" command.
First question. Are the SHA (Secure Hash Algorithm) codes contained in the file patch important? Let me explain better. Once the patch file is made, if I edit it with a text editor by adding or removing parts, the SHA codes not match with the new file content, is it right? Under these conditions, does the patch file still work correctly?
Second question. To make the patch file "my_file.patch" between two files "my_file1.txt" and "my_file2.txt" I use the command
git diff --no-index my_file1.txt my_file2.txt > ./my_file.patch
Let suppose now to have six files named "my_file1.txt", "my_file2.txt", "my_file3.txt", "my_file4.txt", "my_file5.txt" and "my_file6.txt". What is the way to create ONE ONLY patch file that compare and patches the couples my_file1.txt/my_file2.txt, my_file3.txt/my_file4.txt and my_file5.txt/my_file6.txt?
Many thanks
Regards
Solved! Go to Solution.
2023-06-20 06:00 AM - edited 2023-06-20 06:03 AM
Hello @nataut ,
On a patch, SHA1 is most of all a unique identifier that can point on a specific commit just by its SHA1 number. In your case, if I well understand, you have to "combine" different commits in one to send it easier. This is more a git question than a ST question and you should be able to find a trick online. I think that a such link can help you.
(Mentioned on the previous link:
git format-patch <SHA1_start>^..<SHA1_end> --stdout > final.patch
Then git am final.patch to apply)
Kind regards,
Erwan.
2023-06-20 03:37 AM
Sorry, I made a mistake copying and pasting the message. I rewrite it.
I would like clarification about the structure of a patch file made with the "git diff" command
First question. Are the SHA (Secure Hash Algorithm) codes contained in the file patch important? Let me explain better. Once the patch file is made, if I edit it with a text editor by adding or removing parts, the SHA codes not match with the new file content, is it right? Under these conditions, does the patch file still work correctly?
Second question. To make the patch file "my_file.patch" between two files "my_file1.txt" and "my_file2.txt" I use the command
git diff --no-index my_file1.txt my_file2.txt > ./my_file.patch
Let suppose now to have six files named "my_file1.txt", "my_file2.txt", "my_file3.txt", "my_file4.txt", "my_file5.txt" and "my_file6.txt". What is the way to create ONE ONLY patch file that compare and patches the couples my_file1.txt/my_file2.txt, my_file3.txt/my_file4.txt and my_file5.txt/my_file6.txt?
Many thanks
Regards
2023-06-20 06:00 AM - edited 2023-06-20 06:03 AM
Hello @nataut ,
On a patch, SHA1 is most of all a unique identifier that can point on a specific commit just by its SHA1 number. In your case, if I well understand, you have to "combine" different commits in one to send it easier. This is more a git question than a ST question and you should be able to find a trick online. I think that a such link can help you.
(Mentioned on the previous link:
git format-patch <SHA1_start>^..<SHA1_end> --stdout > final.patch
Then git am final.patch to apply)
Kind regards,
Erwan.
2023-06-20 06:55 AM