我希望将此逻辑合并到一个bash脚本中:如果当前存储库有任何本地更改,则停止处理。
#!/bin/bash
set -ex
git pull
git update
# Disallow unstaged changes in the working tree
if ! git diff-files --check --exit-code --ignore-submodules -- >&2
then
echo >&2 "error: you have unstaged changes."
exit 1
fi
# Disallow uncommitted changes in the index
if ! git diff-index --cached --exit-code -r --ignore-submodules HEAD -- >&2
then
echo >&2 "error: your index contains uncommitted changes."
exit 1
fi发布于 2013-06-07 08:36:48
这应该可以做到:
if [ -n "$(hg status -mar)" ]
then
echo >&2 "error: your index contains uncommitted changes."
exit 1
fi检查任何移动、添加或删除的文件。如果您想检查已删除(缺失)或未知但不被忽略,您也可以这样做。
https://stackoverflow.com/questions/16963619
复制相似问题