Skip to content

Commit 78c7e2a

Browse files
authored
Revert "chore(monorepo): stash in pre-commit to avoid all changes to partially commited files to end up in commit" (#7565)
Revert "chore(monorepo): stash in pre-commit to avoid all changes to partiall…" This reverts commit 50adb49.
1 parent 9a38cb7 commit 78c7e2a

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

.husky/pre-commit

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@
44
# listings staged files only
55
fileList=$(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-
207
if [ -n "$fileList" ]; then
218
echo "Prettifying staged files..."
229
npx prettier-compass --write --ignore-unknown $fileList

0 commit comments

Comments
 (0)