Just so you know, "git -amend" doesn't amend anything.
It gets parsed as: git -a -m 'end'
That is, it commits all modified files with a message that just says "end"
I suffer so you don't have to 🤦♂️
@jon_valdes I have a surprisingly high amount of commits with the message"--no-edit" because I always type "git commit -a --amend -m --no-edit"
@jon_valdes sounds like you should add an alias in your bashrc ...
@jon_valdes It doesn't though.
Guess it depends on the version, or even underlying OS?
@berkes sorry, it's git commit -amend
@jon_valdes It doesn't either. Maybe you are on a -rc version, or an old version?
@berkes yep, someone else pointed that out too. It turns out I happened to misspell it and went past the warning https://mastodon.technology/@jon_valdes/100672955598330505
@jon_valdes If I had a nickel for every time I typed “git —amen”...
Nice anecdote, but when did that (last) cause you trouble? Asking because there is a safeguard in place for 11 years now:
$ git commit -amend
error: did you mean `--amend` (with two dashes ?)
The commit introducing this is: https://github.com/git/git/commit/3a9f0f41db87e197708f84aeb2487bc983f99c9c
@danimo I found out because it happened on my laptop 1 minute before I posted that toot. Laptop's Ubuntu 18.4, with whatever git version it is that comes with it 🤷♂️
Ha! I just checked, and I had mispelled "amend" as "ammend". The correct spelling does give a warning. The wrong one doesn't
@jon_valdes And this is why I abhore using dashes (or anything else) to flag options. I'm dating myself, but I still like the Tripos/AmigaDOS way of dealing with options and flags. The latter has its own quirks, but they err on the humorous, not the destructive.
@jon_valdes been there, done that. I know how you feel. That tiny dash ...
@jon_valdes double dashes matter :0
@jon_valdes -a is for --all option not for --amend...
@jon_valdes This is an excellent gotcha, up there with the time I "tar *"'d my home directory, excluding all dotfiles by accident.
If it helps, (sans Java) the general rule is fully spelled out flags get two hyphens while single letter flags get one.
So, if amend were a flag, you'd do `git --amend` and, if there weren't any, it would (I'd think) just safely error out. Because there was just one hyphen used (and those can be chained into just one hyphen, usually), it reached for any single-letter flags were valid and used those.
That's how it tends to work for Linux/Unix, at least.
This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either! We adhere to an adapted version of the TootCat Code of Conduct and follow the Toot Café list of blocked instances. Ash is the admin and is supported by Fuzzface, Brian!, and Daniel Glus as moderators. Hosting costs are largely covered by our generous supporters on Patreon – thanks for all the help!