jumanjihouse / pre-commit-hooks

git pre-commit hooks that work with http://pre-commit.com/
MIT License
114 stars 52 forks source link

False Positive When A Pushed Commit Is Amended #93

Open Kurt-von-Laven opened 2 years ago

Kurt-von-Laven commented 2 years ago

protect-first-parent reports an error once you amend a commit that has already been pushed to a feature branch even though this doesn't constitute a foxtrot merge.

Protect first parent..........................................................Failed
- hook id: protect-first-parent
- exit code: 1

[ERROR] Foxtrot merge

Maybe you deleted a commit that was already pushed.
Maybe you ran "git pull" without the --rebase flag.

A possible fix is to run these commands client-side before pushing:

    git fetch --all
    git rebase origin/pre-commit

Check the result with "git log --graph" before pushing again.

Perhaps a distinction should be made between the default branch and other branches?