0
git commit --amend "doesnt work"
git commit -a -m "doesnt work"
Vampire
  • 35,631
  • 4
  • 76
  • 102
user1873073
  • 3,580
  • 5
  • 46
  • 81
  • 1
    I've searched your question's title in Google and found in the first 3 results the duplicate which I'll suggest as a close reason and [Github's documentation](https://help.github.com/articles/changing-a-commit-message/) which seems rather comprehensive. Any problem with these two ressources? – Aaron Jun 16 '17 at 14:04
  • i already pushed it. i spelled text "tex". .. at the time i had not pushed it yet. im just asking for future reference. – user1873073 Jun 16 '17 at 14:04
  • 2
    @Deathstorm - It is not true that you can only amend a commit if it isn't pushed. It is true that you probably *should* only amend a commit if it isn't pushed yet, but nothing prevents it and it wouldn't explain why OP is seeing this behavior. – Mark Adelsberger Jun 16 '17 at 14:06
  • 4
    @user1873073 - If 99% of your question text is complaining about how you assume the question will be handled, then you might as well not post it. – Mark Adelsberger Jun 16 '17 at 14:06
  • to clarify, im asking for if you have not already pushed it – user1873073 Jun 16 '17 at 14:06
  • 2
    Great. Remove all the pre-emptive complaining so we don't have to fish through that to find the relevant info. Then add all the relevant info (like when you say "doesn't work" clarify what it does and what you expected it to do). Then maybe you'll get a useful answer. – Mark Adelsberger Jun 16 '17 at 14:08
  • allright, ill just spend more time messing with it next time. it said pathspec did not match files. ...i botched the command somewhere. – user1873073 Jun 16 '17 at 14:10
  • @user1873073 also insults should not be tolerated here, if you really receive some please flag the offending comments or answers for moderator intervention. – Aaron Jun 16 '17 at 14:11
  • I see... so you literally typed the commit message after the `--amend` option in the first case (which was interpreted as a filename, but no such file exists). In the second case, you used `-a` instead of `--amend` (but `-a` is not short for `--amend`, it's a different option). What you wanted was `git commit --amend -m "works"` – Mark Adelsberger Jun 16 '17 at 14:14

1 Answers1

2

It seems you assume -a is the same as --amend, which is not the case.
You almost had the right command which simply is git commit --amend -m 'does work'.

Vampire
  • 35,631
  • 4
  • 76
  • 102