How can I check in a Bash script if my local Git repository has changes?

10/17 00:15
阅读数 0

问题:

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
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部