i have installed mvn java-formatter:format task in pre-commit hook. task format java source codes.
pushd src/ > /dev/null mvn java-formatter:format retval=$? if (($retval == 1)); exit 1 fi popd > /dev/null i need append newly formatted source files commit. how can this?
the pre-commit hook should able include git add, modify index committed.
see example "git pre-commit hook, add file index".
try git add -a :/. (see "add if root folder of repository")
if need add files staged, need:
- either add files per pattern
- or filter only staged files, in
git add $(git diff --name-only --cached).
Comments
Post a Comment