Reputation: 149
I messed up a git commit
command. First of all I used the -a
option instead of the --amend
option. I also misspelled the --amend
option.
C:\Users\Slew\Documents\my-repo>git commit -ammend -m "fix links in default layout"
[main 97328ff] mend
2 files changed, 61 insertions(+), 8 deletions(-)
When I look at the commit history in my repository on GitHub, I see a commit called mend
with three dots next to it. If I click the three dots, it reveals another message, which is the commit message I originally intended - fix links in default layout
.
How has the -a
option actually named this commit and what happened to that extra letter "m" which I accidentally added?
Upvotes: 3
Views: 102
Reputation: 23255
-am
is shorthand for -a -m
, where the mend
following the m
was interpreted as argument to -m
.
Furthermore, option -m
can be repeated, git commit
collects the strings and add all of them (separated by empty lines) to the commit message (see https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--mltmsggt).
So the command above is git commit -a -m mend -m "fix links in default layout"
.
Upvotes: 2