protect-first-parent reports an error when attempting to commit the second commit in a repository.
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 main
Check the result with "git log --graph" before pushing again.
[FAIL] See errors above for /home/kurt/.cache/pre-commit/repoyqzer_ly/pre_commit_hooks/protect-first-parent
While testing this again on a fresh repository, I also see the following:
fatal: ambiguous argument 'main^..': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
It doesn't make any difference whether the second commit is to the default branch or a feature branch. The second case seems obviously caused by the attempt to get the commit before the HEAD of main, and presumably this also causes a crash for the initial commit to a repository. Since the HEAD of main is the initial commit, this fails. I don't understand what causes the first case yet though.
protect-first-parent
reports an error when attempting to commit the second commit in a repository.While testing this again on a fresh repository, I also see the following:
It doesn't make any difference whether the second commit is to the default branch or a feature branch. The second case seems obviously caused by the attempt to get the commit before the
HEAD
of main, and presumably this also causes a crash for the initial commit to a repository. Since theHEAD
of main is the initial commit, this fails. I don't understand what causes the first case yet though.