lazygit
lazygit copied to clipboard
When rewording a merge commit with the editor, lazygit calls git incorrectly
Describe the bug When rewording a merge commit using the editor, lazy git calls git with an incorrect set of arguments. This results in the operation failing.
To Reproduce Steps to reproduce the behavior:
- Create a merge commit
- Reword it with the editor
- Observe failed editor launch
Expected behavior The editor should open without issue, allowing a reword.
Screenshots

Desktop (please complete the following information):
- OS: Arch
- Lazygit Version 0.35.367b0d33
Note: it works fine using the builtin editor.
For the time being, does the merge commit you're trying to reword happen to be the same as HEAD?
If so, could you give #2065 a spin to see if it helps?
Yeah, it was the HEAD commit. I'll try that PR now, do you have instructions on how to grab it? Will i just clone & compile or is there another process?
Just clone it, be sure to check out the branch, and run it with go run main.go.
Got it, also in my testing today I am realising that the merge could not have been HEAD, because when it is actually HEAD, lazygit just runs git commit --amend instead of the previously posted git rebase.
That branch did not fix the issue.
Strangely, it now complains that rewording is not available for GPG users when using the builtin editor, which was not the case when i last tested. I did testing in /tmp the last time and have since rebooted, so i'm not sure if that's the issue?
EDIT: With further testing, it's probably because it cant resign the commits if they arent the HEAD? I'm not sure, this limitation doesnt exist within git itself though.
lazygit just runs git commit --amend instead of the previously posted git rebase
When using editor on current master to reword a commit it always starts an interactive rebase. It shouldn't be so, but hey.
I did testing in /tmp the last time and have since rebooted, so i'm not sure if that's the issue?
I've had issues using my editor in /tmp for some reason, never got to the bottom of it, though. I'd advise cloning the repo somewhere else in your $HOME.
With further testing, it's probably because it cant resign the commits if they arent the HEAD?
Uhhh... now it literally runs git commit --allow-empty --amend --only, does that work when invoked from the CLI?
I can try moving the repo, just to rule it out.
The command mentioned does work from the CLI, though of course it just redoes HEAD, which worked anyways.
Very strange behaviour indeed.
which worked anyways
Not with the editor it didn't :)
That was an error in my part:
[..] I am realising that the merge could not have been HEAD, because when it is actually HEAD, lazygit just runs git commit --amend instead of the previously posted git rebase.
The amend command works, including with the editor, its the rebase thats failing.
To summarise:
Reword HEAD (builtin): Works (uses --amend) Reword HEAD (editor): Works (uses --amend)
Reword not HEAD (builtin): Does not work, complains about GPG (uses rebase) Reword not HEAD (editor): Does not work, git errors (uses rebase)
(All of them operating on merge commits)
The amend command works, including with the editor, its the rebase thats failing.
On master it didn't work, on the PR it should work.
The amend command works, including with the editor, its the rebase thats failing.
Alright, then we need a bit deeper rework. Thanks for the report!
If you'd be willing to take a dive, please let us know and feel free to visit us on slack if you need any pointers or have questions!
Ah, right, yeah. The reword on HEAD works fine on the PR branch. I can take a look now, I don't have much go knowledge but it should be enough to make this work. Should I just PR / push onto the existing fix branch?
As for slack, I'll need to grab an account, and I'll see you there.
Should I just PR / push onto the existing fix branch?
I believe you don't have the permission to do that, but you can create a fork.
I don't have much go knowledge but it should be enough to make this work.
I don't think knowledge of go (or lack thereof) will be a problem here, git intricacies might be, though.