4 # https://stackoverflow.com/a/3879077
5 # https://creativecommons.org/licenses/by-sa/4.0/
8 git update
-index -q --ignore-submodules --refresh
11 # Disallow unstaged changes in the working tree
12 if ! git
diff-files --quiet --ignore-submodules --
14 echo >&2 "cannot $1: you have unstaged changes."
15 git
diff-files --name-status -r --ignore-submodules -- >&2
19 # Disallow uncommitted changes in the index
20 if ! git
diff-index --cached --quiet HEAD
--ignore-submodules --
22 echo >&2 "cannot $1: your index contains uncommitted changes."
23 git
diff-index --cached --name-status -r --ignore-submodules HEAD
-- >&2
29 echo >&2 "Please commit or stash them."