Skip to content

init shouldn't overwrite existing hook scripts #142

@davidalpert

Description

@davidalpert

Is your feature request related to a problem? Please describe.
When running git mob init the init command should be smart enough to respect existing hook scripts, and when uninstalling git-mob the hook scripts should be smart enough to avoid failing when git-mob is not found in the PATH.

Describe the solution you'd like
The first part might be addressed by adding a default failure method when the relevant hook scripts already exist, then enhancing the init command with some additional flags like:

  • --force to force overwrite
  • --amend to amend git-mob to the hook scripts
  • --prepend to prepend git-mob to the hook scripts

Additional context

The current approach to git mob init (as far as I know) is to update the prepare-commit-msg hook script in the local .git/ folder. I believe that currently we simply overwrite that script. This is a naive approach that assumes the mobber is not already using hook scripts in their repo.

There are other tools however (e.g. husky https://typicode.github.io/husky/) which use git hooks to kick off their workflow, so let's mature this integration and stop assuming that we "own" the hook scripts as the only actor.

This will let the git-mob integration work more smoothly with others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions