Describe the bug
If you attempt to edit a previous commit with the pre-commit hook installed then you lose commits.
To Reproduce
Steps to reproduce the behavior:
Using https://github.com/IBM/container-registry-go-sdk as an example repo with the pre-commit hook installed at version 0.13.1+ibm.61.dss:
$ git log --oneline | head
943acf0 Merge pull request #28 from IBM/readme-travis
72f474c fix(doc) README.md must reference VA v4
8053838 chore(release): 1.0.0 release notes [skip ci]
96482bf Update version 0.0.17 -> 1.0.0 [skip ci]
4e47a25 Merge pull request #27 from IBM/vav4
cca8d61 feat(upgrade) replace vav3 with vav4
36a97ac chore(release): 0.0.17 release notes [skip ci]
6587ec7 Update version 0.0.16 -> 0.0.17 [skip ci]
4268846 Merge pull request #26 from IBM/relfix
1101165 build(fix) travis deploy/release
$ git rebase -i HEAD~3 # and choose to edit `e` the oldest commit
Stopped at 96482bf... Update version 0.0.17 -> 1.0.0 [skip ci]
You can amend the commit now, with
git commit --amend '-S'
Once you are satisfied with your changes, run
git rebase --continue
$ touch this
$ git add this
$ git commit --amen
Detect secrets...........................................................Passed
[detached HEAD e5fff84] Update version 0.0.17 -> 1.0.0 [skip ci]
Author: semantic-release-bot <semantic-release-bot@martynus.net>
Date: Thu May 25 12:10:18 2023 +0000
4 files changed, 5 insertions(+), 5 deletions(-)
create mode 100644 this
$ git rebase --continue
Successfully rebased and updated refs/heads/main.
$ git status
On branch main
Your branch and 'origin/main' have diverged,
and have 3 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
$ git log --oneline | head
2dde941 fix(doc) README.md must reference VA v4
4bfaac6 chore(release): 1.0.0 release notes [skip ci]
e5fff84 Update version 0.0.17 -> 1.0.0 [skip ci]
4e47a25 Merge pull request #27 from IBM/vav4
cca8d61 feat(upgrade) replace vav3 with vav4
36a97ac chore(release): 0.0.17 release notes [skip ci]
6587ec7 Update version 0.0.16 -> 0.0.17 [skip ci]
4268846 Merge pull request #26 from IBM/relfix
1101165 build(fix) travis deploy/release
0a64536 Merge pull request #24 from IBM/deps
alandaws@Brackens-MacBook-Pro ~/src/github.com/IBM/container-registry-go-sdk (main)± <healthcheck-dev> {IKS Registry Production EU-FR2}
Expected behavior
Rebase to work, file to be added to HEAD~3 and HEAD to remain the same commit with a new sha.
Actual behaviour
Rebase appears to have worked but HEAD commit is lost!
Impact
Cannot interactively rebase with detect-secrets pre-commit hook installed.
Describe the bug If you attempt to edit a previous commit with the pre-commit hook installed then you lose commits.
To Reproduce Steps to reproduce the behavior: Using
https://github.com/IBM/container-registry-go-sdk
as an example repo with the pre-commit hook installed at version0.13.1+ibm.61.dss
:Expected behavior Rebase to work, file to be added to HEAD~3 and HEAD to remain the same commit with a new sha.
Actual behaviour Rebase appears to have worked but HEAD commit is lost!
Impact Cannot interactively rebase with detect-secrets pre-commit hook installed.
Additional context: