Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] git pre-commit hook breaks interactive rebase, looses comits #134

Open
brackendawson opened this issue Jul 20, 2023 · 0 comments
Open

Comments

@brackendawson
Copy link
Member

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 <[email protected]>
 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.

Additional context:

  • Operating environment:
    • detect-secrets: 0.13.1+ibm.61.dss
    • git: git version 2.39.2 (Apple Git-143)
  • Host or local: local
  • Operating System macos 13.4.1
  • Languages scanned etc: n/a
  • Repo & build context links: https://github.com/IBM/container-registry-go-sdk
  • Log output: see recreate steps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant