question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for `pre-rebase` Hook

See original GitHub issue

Is there a pre-commit hook that can prevent rebase operations? It looks like git does support a pre-rebase hook, but I didn’t see it in the docs.

I checked here.

Example pre-rebase hook:

https://gist.github.com/uasi/9384329

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Nov 4, 2022

if you’re trying to hook into individual “commits” that (for example) an interactive rebase makes unfortunately I don’t think there’s a way to do that (git rebase --continue skips hooks in my experience)

0reactions
adamchainzcommented, Nov 7, 2022

I just blogged about a solution to run hooks during rebase:

$ git rebase -x 'pre-commit run --from-ref HEAD~ --to-ref HEAD' main
Read more comments on GitHub >

github_iconTop Results From Across the Web

githooks Documentation - Git
This hook is called by git-rebase[1] and can be used to prevent a branch from getting rebased. The hook may be called with...
Read more >
Git Hooks | Atlassian Git Tutorial
Git Hooks are scripts that run automatically every time a particular event occurs in a Git repository. Learn what they do and how...
Read more >
What git hooks apply to 'git rebase --continue'? - Stack Overflow
I idon't understand why the pre-commit hook isn't invoked? Surely a rebase (especially after a merge resolution!) is committing new code?
Read more >
Support for the pre-rebase hook. (I04b346af) · Gerrit Code ...
Introduces support for the pre-rebase hook into JGit, along with the --no-verify rebase command option to bypass it. Also added unit tests.
Read more >
Git Hooks | Learn how to use pre-commit hooks, post-commit ...
An introductory guide and resource for Git hooks. Learn how to use pre-commit hooks, post-commit hooks, post-receive hooks, and more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found