Skip to content

Adds option to skip pre-commit hooks per commit - #20721

Closed
octopols wants to merge 1 commit into
desktop:developmentfrom
octopols:octopols/disable-git-hooks
Closed

octopols wants to merge 1 commit into
desktop:developmentfrom
octopols:octopols/disable-git-hooks

Conversation

@octopols

@octopols octopols commented Jul 5, 2025

Copy link
Copy Markdown

Closes #[issue number]

Description

This PR adds the ability for users to skip pre-commit hooks on a per-commit basis by adding a checkbox to the commit UI that enables the --no-verify flag when creating commits.

Changes Made:

  • Model Layer: Added skipPrecommitHooks?: boolean to the ICommitContext interface
  • Git Layer: Updated createCommit function to accept and use the skipPrecommitHooks parameter, appending --no-verify to the git command when enabled
  • UI Layer: Added "Skip pre-commit hooks" checkbox to the commit message form with proper state management
  • Store Layer: Updated the app store to pass the skipPrecommitHooks property from the commit context to the createCommit function
  • Styling: Added appropriate CSS styling for the new checkbox section

Design Decisions:

  • Per-commit basis: The option is available for each individual commit rather than a global setting, giving users flexibility to skip hooks only when needed
  • Checkbox placement: Positioned after the description field for logical flow and discoverability
  • Default state: The checkbox defaults to unchecked (hooks enabled) to maintain current behavior
  • Clear labeling: Used "Skip pre-commit hooks" as the label for clarity about what the option does

Testing:

  • All TypeScript compilation passes without errors
  • Development build completes successfully
  • Complete data flow verified from UI checkbox to git command execution

Screenshots

disable_pre_commit

Release notes

Notes: Added option to skip pre-commit hooks per commit. Users can now check a "Skip pre-commit hooks" checkbox in the commit UI to bypass pre-commit hooks for individual commits using the --no-verify flag.

@github-actions github-actions Bot added external Pull request originating outside of the Desktop core team triage For incoming issues labels Jul 5, 2025
@tidy-dev

tidy-dev commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

@octopols Thanks for wanting to contribute. However, this design is not something we want to incorporate. We have ongoing discussions about what modifying the commit area would look like in order to add more commit options aside from skipping hooks as well as design/engineering discussions for how to better handle hooks in general (skipping and failures). Taking this on in depth would require design and engineering capacity from our end that we do not currently have available.

If you want to take a crack at a "Commit Anyway" dialog that appears on failure of a commit with hooks, we can take a look at that type of PR with a less invasive UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Pull request originating outside of the Desktop core team triage For incoming issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants