Run pre-commit while running rebase --continue
See original GitHub issueHere’s the use case I’ve recently encountered:
- Your branch has gone stale, so you rebase off of the main branch
- Merge conflicts arise, so you solve them as they come and run
git rebase --continue
without creating new commits pre-commit
doesn’t run, leaving style violations and lint errors in the new commit history 😿
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
What git hooks apply to 'git rebase --continue'? - Stack Overflow
This means commit hooks will run (pre-commit, commit-msg, post-commit, etc). There are other situations when rebasing where you can opt to ...
Read more >pre-commit: How to run hooks during a rebase - Adam Johnson
pre-commit uses Git's hook system to run tools when you commit. Unfortunately, Git doesn't run any hooks when making a commit during a...
Read more >pre-commit
The first time pre-commit runs on a file it will automatically download, install, and run the hook. Note that running a hook for...
Read more >How to skip Git commit hooks | bobbyhadz
Use the --no-verify option to skip git commit hooks, e.g. git commit -m "commit message" --no-verify . When the --no-verify option is used,...
Read more >githooks Documentation - Git
The default pre-applypatch hook, when enabled, runs the pre-commit hook, ... This hook is called by git-rebase[1] and can be used to prevent...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Adding to this thread, I am using a trick to deal with the git limitation:
This is pretty useful when pre-commit rules were updated in
master
and you want to reapply to all commits in your working branch. Must also work well inrebase --continue
.To make it easier, I added a git alias 😄
Source: https://asciinema.org/a/222023
unfortunately, there’s no
git
hook that fires ongit rebase --continue
but, fortunately, as long as you’ve run
git add
, you can runpre-commit
manually and it will act the same as if you had run agit commit