I'm wondering why my git alias got stuck and how it caused a rebase.
Steps to reproduce:
git config --global alias.am "commit --amend"
I can see that the alias is added with:
git config --global -e
[alias]
am = commit --amend --no-edit
Create new test repo:
> git init
> git am
Ctrl + c, Ctrl + c
Nothing happens so I have to close it manually. The expected result would be fatal: You have nothing to amend.
in this case since there are no commits. But what happens is that git is now in rebase mode: (master|AM/REBASE)
When running in a repo with a commit, the expected result is to open my default git editor so I can edit the commit message but the same unexpected behaviour explained above happens.
The question
How come my git am alias gets stuck as it does, and how does it put me in a rebase situation?
What I have tried
I guess that my git alias is faulty in some way and that it causes it to start the git commit --amend
but in a way so its unable to start the editor. And since a git commit --amend probably does a rebase in the background to do its thing it is left in that state when I force it to abort?
However, I have tried to add --no-edit to no avail so it seems not to be an editor error..
This issue caused me to accidentally do a git rebase --abort
and lose some local non-staged changes.
System
I'm on Windows 10 using Git Bash.
I have tested using both emacs and notepad as my default git editors, both with the same result.