Git Export the difference file between the two versions and package the publisher

1. View version
$ git log --pretty=oneline
2. Difference file and package

When you publish code, you can use the following command , Export the last submitted modified file , Export code merged from other branches
git archive -o ../update.zip HEAD $(git diff --name-only HEAD^)

If you need to release a few git Version code , You can export the specified submission with the following command id Between the modified file
git archive -o ../update.zip NEW_COMMIT_ID_HERE $(git diff --name-only
OLD_COMMIT_ID_HERE NEW_COMMIT_ID_HERE)
perhaps ( recommend ),linux There is a command provided xargs It can convert the output of the previous command into the parameters of another command , In this way, you can use the following command .
git diff --name-only OLD_COMMIT_ID_HERE  NEW_COMMIT_ID_HERE | xargs tar -zcvf
../update.tar.gz git diff --name-only OLD_COMMIT_ID_HERE  NEW_COMMIT_ID_HERE|
xargs zip update.zip
OLD_COMMIT_ID_HERE   This is the old version number

NEW_COMMIT_ID_HERE   This is the version number that cannot be sent to that version

 

Technology
Daily Recommendation