commitizen / commitizen/cz-cli

Config with prepare-commit-msg blocks squashing via interactive rebase

Aperta
#669 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
17.5k
Fork
566
Merge medio
8h 16m
PR unite (30g)
1

Descrizione

Hello, first off thanks for making this wonderful library.

I'm currently using husky to enforce commitizen on every commit. It's been working fine, however, there are times when I need to manually squash certain commits. To do this, [I use an interactive rebase (ex: `git rebase -i HEAD~4`)](https://github.com/todotxt/todo.txt-android/wiki/Squash-All-Commits-Related-to-a-Single-Issue-into-a-Single-Commit). Whenever I do this it gets stuck and the rebase has to abort.

I've tried the [following solution](https://gmurphey.github.io/2013/02/02/ignoring-git-hooks-when-rebasing.html#.XV3d2pNKgqs):

```
#!/bin/sh
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')

if [ $BRANCH_NAME != '(no branch)' ]
then
exec < /dev/tty && git-cz --hook || true
fi
```

However, it doesn't work, I presume, when in the squashing step. It just freezes.

I've also had trouble running `yarn version --no-commit-hooks` and `yarn config set version-commit-hooks false`, which also freezes

Any idea on how to get around this?

Update: for husky v2.4.0 and above, it seems like you can use `HUSKY_SKIP_HOOKS=1 git rebase ...`. I'll go this route for now, however, I'll leave the issue open in case there's a better alternative for those not using husky

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Riproduci il freeze con `git rebase -i HEAD~4`, il workaround mostrato per l’hook `prepare-commit-msg` e `yarn version --no-commit-hooks`. Traccia come vengono invocati gli hook di commit durante il rebase interattivo e il versionamento, quindi considera completato il lavoro quando il freeze viene evitato senza affidarsi a `HUSKY_SKIP_HOOKS=1`, preservando al contempo l’applicazione normale di commitizen.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
git, javascript
Ambito
cli, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.