I have this alias in my ~/.gitconfig
:
[alias]
am = commit -a --amend -C HEAD
Yet, when I run git am
, it hangs, and I get (master|AM/REBASE)
at the prompt, and I have to run git am --abort
.
There already is a git am
command. Your alias is invalid (since there already is such a command), and when you run git am
, you're actually executing this command. If you chose a different alias, such as ca
(short for "commit amend"), it should work:
[alias]
ca = commit -a --amend -C HEAD
As a side note, git commit
has a --no-edit
flag you can use instead of -C HEAD
:
[alias]
ca = commit -a --amend --no-edit
There is a standard git am
command that Applies (patches from) Mailbox. In git aliases cannot override standard commands, so even if you have an alias git am
runs the standard command and the command awaits input at the standard input. So it doesn't hang, it's just waiting.
Rename the alias to something not already among standard git commands.