Git: retrieve specific commit
2 Solutions collect form web for “Git: retrieve specific commit”
To export the repository up to a certain commit:
git archive -o export.zip <COMMIT>. Replace
<COMMIT> with the commit number you want to export.
To create a patch between two commits:
git diff COMMIT1 COMMIT2 > patch.txt
Git has a handy way of creating a patch for each commit. Although this originally was meant as a way to format patches so that they can be sent through email, they are a handy way of extracting a set of changes.
The command you want is
git format-patch and the way you apply these formatted patches back into git is with the
git am command.
For example if you you have two commits C1 and Cn that you want to export as a set of git patches you only need:
git format-patch -k C1..Cn
This will create a set of numbered patches (in your current directory). Each patch will be a diff of the commit, as well as the commit information (Title, comment, author, date, etc).
This is a lot more than a simple diff file between two commits will provide you.