問題:
There are some scripts that do not work correctly if they check for changes.如果檢查更改,有些腳本將無法正常工作。
I tried it like this:我是這樣試的:
VN=$(git describe --abbrev=7 HEAD 2>/dev/null)
git update-index -q --refresh
CHANGED=$(git diff-index --name-only HEAD --)
if [ ! -z $CHANGED ];
then VN="$VN-mod"
fi
Is there some kind of boolean check if there has been changes since the last commit, or how can I really test if there are new changes to my local repository?是否有某種布爾檢查自上次提交以來是否有更改,或者我如何真正測試本地存儲庫是否有新更改?
I'm doing all this for a version creation script (that I found somewhere here).我正在爲版本創建腳本(我在此處找到的某個地方)執行所有這些操作。
解決方案:
參考一: https://en.stackoom.com/question/La8R參考二: https://stackoom.com/question/La8R