You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
branchless: processing 1 update: ref HEAD
branchless: processed commit: 5a276e8b more feature2 work
[detached HEAD 5a276e8] more feature2 work
1 file changed, 1 insertion(+)
Current repo state
➜ git:(5a276e8) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
◯ bff4f430 1h (feature2) feature2 work
┣━┓
┃ ◯ 5cd580b9 26m (feature3) feature3 work
┃ ┃
┃ ◯ e106b908 26m (feature4) feature4 work
┃
● 5a276e8b 2s more feature2 work
Continue with rebase
➜ git:(5a276e8) git rebase --continue
branchless: processing 1 update: ref HEAD
branchless: processed commit: e91c1769 feature3 work
branchless: processing 1 update: ref HEAD
branchless: processed commit: c514ede7 feature4 work
branchless: processing 1 update: branch feature4
branchless: processing 3 rewritten commits
branchless: This operation abandoned 1 commit and 2 branches (feature2, feature3)!
branchless: Consider running one of the following:
branchless: - git restack: re-apply the abandoned commits/branches
branchless: (this is most likely what you want to do)
branchless: - git smartlog: assess the situation
branchless: - git hide [...]: hide the commits from the smartlog
branchless: - git undo: undo the operation
branchless: - git config branchless.restack.warnAbandoned false: suppress this message
Successfully rebased and updated refs/heads/feature4.
Current repo state
➜ git:(feature4) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
✕ bff4f430 1h (rewritten as 5a276e8b) (feature2) feature2 work # This is WRONG ❌
┣━┓
┃ ✕ 5cd580b9 26m (rewritten as e91c1769) (feature3) feature3 work
┃
◯ 5a276e8b 23s more feature2 work
┃
◯ e91c1769 2s feature3 work
┃
● c514ede7 2s (feature4) feature4 work
I cannot git restack anymore
➜ git:(feature4) git restack
This operation failed because it would introduce a cycle:
┌─ᐅ 5a276e8b more feature2 work
└── 5a276e8b more feature2 work
Expected behavior
bff4f430 is NOT rewritten as 5a276e8b. I think the log should read like this:
➜ git:(feature4) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
◯ bff4f430 1h (feature2) feature2 work
┣━┓
┃ ✕ 5cd580b9 26m (rewritten as e91c1769) (feature3) feature3 work
┣━┓
┃ ✕ e106b908 26m (rewritten as c514ede7) (feature4) feature4 work
┃
◯ 5a276e8b 23s more feature2 work
┃
◯ e91c1769 2s feature3 work
┃
● c514ede7 2s (feature4) feature4 work
Or, if restack shouldn't even be required here, we should not show the rewritten commits and the log should be:
➜ git:(feature4) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
◯ bff4f430 1h (feature2) feature2 work
┃
◯ 5a276e8b 23s more feature2 work
┃
◯ e91c1769 2s feature3 work
┃
● c514ede7 2s (feature4) feature4 work
Actual behavior
Log says:
✕ bff4f430 1h (rewritten as 5a276e8b) (feature2) feature2 work # This is WRONG ❌
restack is broken
Version of git-branchless
git-branchless 0.3.9
Version of git
git 2.32.0
Version of rustc
rustc 1.59.0
Automated bug report
No response
The text was updated successfully, but these errors were encountered:
Thanks for the report! I never use edit with git rebase -i, so I wouldn't have noticed this myself. For the future, you might want to check out the commit directly as discussed here #315 (comment), rather than use edit.
To restore your git restack, you can clear the git-branchless database by running rm .git/branchless/db.sqlite3. Make sure that you have branches pointing to all of the commits you care about (but it sounds like you're using a primarily branch-based workflow, so you probably don't need to worry).
The rewrite information comes from the data provided by Git via the post-rewrite hook, which is invoked at the end of the git rebase. Most likely I didn't handle the case of edit correctly.
This is also kind of related to the item "Aborted git rebases leave any applied commits in the smartlog." in #1. The best overall solution might be to implement our own git rebase -i alternative (#177) which interoperates better with git-branchless, rather than to continue working around git rebase -i issues.
Description of the bug
Current repo state
➜ git:(feature4) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
◯ bff4f430 1h (feature2) feature2 work
┃
◯ 5cd580b9 25m (feature3) feature3 work
┃
● e106b908 25m (feature4) feature4 work
Initiate a rebase
➜ git:(feature4) git rebase -i HEAD~4
change bff4f430 from
pick
toedit
branchless: processing 1 update: ref HEAD
Stopped at bff4f43... feature2 work
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
Create a NEW commit (no amend)
➜ git:(bff4f43) echo "more stuff" >> feature2.txt && git commit -a -m "more feature2 work"
branchless: processing 1 update: ref HEAD
branchless: processed commit: 5a276e8b more feature2 work
[detached HEAD 5a276e8] more feature2 work
1 file changed, 1 insertion(+)
Current repo state
➜ git:(5a276e8) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
◯ bff4f430 1h (feature2) feature2 work
┣━┓
┃ ◯ 5cd580b9 26m (feature3) feature3 work
┃ ┃
┃ ◯ e106b908 26m (feature4) feature4 work
┃
● 5a276e8b 2s more feature2 work
Continue with rebase
➜ git:(5a276e8) git rebase --continue
branchless: processing 1 update: ref HEAD
branchless: processed commit: e91c1769 feature3 work
branchless: processing 1 update: ref HEAD
branchless: processed commit: c514ede7 feature4 work
branchless: processing 1 update: branch feature4
branchless: processing 3 rewritten commits
branchless: This operation abandoned 1 commit and 2 branches (feature2, feature3)!
branchless: Consider running one of the following:
branchless: - git restack: re-apply the abandoned commits/branches
branchless: (this is most likely what you want to do)
branchless: - git smartlog: assess the situation
branchless: - git hide [...]: hide the commits from the smartlog
branchless: - git undo: undo the operation
branchless: - git config branchless.restack.warnAbandoned false: suppress this message
Successfully rebased and updated refs/heads/feature4.
Current repo state
➜ git:(feature4) git sl
◇ 70bcbf7a 1h (main, remote origin/main) Initial commit
┃
◯ 2d27ec27 1h (feature1) feature1 work
┃
✕ bff4f430 1h (rewritten as 5a276e8b) (feature2) feature2 work # This is WRONG ❌
┣━┓
┃ ✕ 5cd580b9 26m (rewritten as e91c1769) (feature3) feature3 work
┃
◯ 5a276e8b 23s more feature2 work
┃
◯ e91c1769 2s feature3 work
┃
● c514ede7 2s (feature4) feature4 work
I cannot
git restack
anymore➜ git:(feature4) git restack
This operation failed because it would introduce a cycle:
┌─ᐅ 5a276e8b more feature2 work
└── 5a276e8b more feature2 work
Expected behavior
bff4f430
is NOT rewritten as5a276e8b
. I think the log should read like this:Or, if restack shouldn't even be required here, we should not show the rewritten commits and the log should be:
Actual behavior
Log says:
✕ bff4f430 1h (rewritten as 5a276e8b) (feature2) feature2 work # This is WRONG ❌
restack is broken
Version of
git-branchless
git-branchless 0.3.9
Version of
git
git 2.32.0
Version of
rustc
rustc 1.59.0
Automated bug report
No response
The text was updated successfully, but these errors were encountered: