File tree Expand file tree Collapse file tree 1 file changed +0
-13
lines changed Expand file tree Collapse file tree 1 file changed +0
-13
lines changed Original file line number Diff line number Diff line change 44# listings staged files only
55fileList=$( git diff --diff-filter=AM --cached --name-only)
66
7- # making sure that pre-commit hook preserves the partial commits where only some
8- # hunks are staged for commit
9- # 1. stash only staged files first (there's no option to stash only uncommited
10- # files, so we have to reverse the logic)
11- git stash --staged -m " pre-commit hook: staged" -q
12- # 2. stash everything that's left
13- git stash -m " pre-commit hook: unstaged" -q
14- # 3. restore staged state
15- git stash pop stash@{1} -q
16-
17- # when script exits, pop the stash with unstaged files
18- trap " git stash pop -q" EXIT
19-
207if [ -n " $fileList " ]; then
218 echo " Prettifying staged files..."
229 npx prettier-compass --write --ignore-unknown $fileList
You can’t perform that action at this time.
0 commit comments