Search code examples
gitgit-configgit-amendgit-alias

Git commit --amend alias hangs


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.


Solution

  • 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