【Git】按照git提交ID导出修改的代码

#!/bin/bash
IFS=$'
'

#conf start commid id
startCommitId=030cd2bf4e3694fe3a3b6f069556c4ea91a9858d
lastCommitId="123"
for log in $(git log  --pretty=oneline)
do
	commitId=${log:0:40}
	desc=${log:41}
	
	#echo "commitId:${commitId} desc:${desc}"
	if [ "123" != "$lastCommitId" ]; then
		#echo "前一次提交ID:${commitId} 当前打包ID:${lastCommitId}"
		git diff --name-only ${commitId} ${lastCommitId}|xargs zip patch/${lastCommitId}.zip
		#echo "command:${comand}"
		#$comand
	fi

	lastCommitId=$commitId

	if [ "$commitId" = "$startCommitId" ];then
		echo "已经到达最后一次提交,直接退出"
		break
	fi

done
原文地址:https://www.cnblogs.com/itaot/p/12088445.html