cancel
Showing results for 
Search instead for 
Did you mean: 

only one patch file to patching multiple couples of files

nataut
Associate III
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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

3 REPLIES 3
nataut
Associate III

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

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.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
nataut
Associate III

Hello @Erwan SZYMANSKI , 

I'll try to read the link you suggested me

Thanks