Does anyone else actually do this besides OP. I've never heard of this problem until now.
Finally I've written a small shell function that corrects "gi tpull" to "git pull", because that happens at least once a day.
(me earlier this month: https://twitter.com/sailoremo/status/908390247548911617)
I think any command where you might start to type something out, but then need to refer to another window or session to figure out what else you want to type, is vulnerable to this kind of mistake.
This process should happen behind the scenes. And then train a RNN for translating it to the following command, which returns a success code. Perhaps, we need to add a few checks that successful command has the same intent as the one which returned 127 error code to the shell.
why type 8 characters 100 times a day, when you can type 1?
Not hatin. Just wondering if I'm alone.
I don't think that can be solved here though.
`alias :q="echo NOT IN VIM!!!"`
https://github.com/jez/dotfiles/blob/master/util/aliases.sh#...
I also have clera, lcear, and lcera -> clear, and :tabe -> vim.
Guilty as charged. I'll commonly start typing git, think about something else, switch to my editor, browser or an other terminal tab, then come back and type "git <command>" in full.
Unsurprisingly…
> rg 'git =' ~/.gitconfig
7: git = ! gitSo, I need to more firmly hit the keys in my actual driver (MS Ergo Keyboard) and now building my own mech...
P.D: ie: Maybe one of the different mech switches are more suited to the way YOU type:
http://www.wasdkeyboards.com/mechanical-keyboard-guide
---
P.D 2: This is a reply to all the ones that state that type wrong some commands.
Also, and maybe more common, is just bad typing. I was far worse before the use of the MS Ergo Keyboard (it DEMAND to use both hands.) So, if the performance change by keyboards (happend to me) maybe is a indication that are the tools at fault here..
As a related issue, it bothers me a lot when I type some command that I want to read the output, and then I proceed to run `ls` right in the sequence and move the output out of the screen.
So... I really fail to see why this article is of any relevance at all, really. Or at least a more global solution would have been better, but I think it's not really an annoyance. For me, it's the same as wanting to fix a UI so that I wouldn't re-double-click a software that I've already started (well, some prevent it, and generally when they do, it means there are sessions, and it annoys me).
Everyone is different. I know an electrical engineer who grew up with dyslexia. So everyone finds their own solutions.
Personally I very rarely spell things wrong in cli.
Then I get distracted on HN ...
gs = git status
ga = git add
gc = git commit
gp = git push
gl = git pull
gt = git tag
- gs is ghostscript
- gc is a component of graphviz
...and all of a sudden your text editor can't generate PDFs anymore when started from the shell.
Instead, I use four-letter aliases which work fine:
- gits = git status
- gitd = git diff
- gitc = git commit
..etc
This is because I want to be the sole controller of what command is actually issued. Call me an old curmudgeon but I just don't trust the auto fix solutions.
Edit: had no idea about Fish. Thank you, all.
Fish-like autosuggestions for zsh: https://github.com/zsh-users/zsh-autosuggestions
for a in $(git var -l | sed -nE 's/^alias\.([^=]*)=.*/\1/p') ; do
if ! command -v g$a >/dev/null 2>&1 ; then
alias g$a="git $a"
fi
done
Which creates a shell alias prefixed with `g` for each of my configured git aliases if there is no conflict. So I get not only the `gst` command you mentioned and ones like `gco` (because I have Subversion-equivalent aliases for common commands), but more complex ones like `gstpup` (stash, pull upstream, stash pop). Combined with `alias g=git`, I seldom type "git" and the setup is pretty convenient. I've thought of making the above alias unconditionally, or report conflicts, as it can be jarring when an alias is missing. I've also considered expanding it to all git commands because sometimes my custom ones live as `git-$command` scripts and not aliases.My newer philosophy toward git aliases is the one described here: http://gggritso.com/human-git-aliases. After reading this I totally overhauled my .gitconfig and replaced it with the one described here and I’m a lot happier.
I can usually get away with typing the first letter of each word. So `gd` for git diff.
I also have a variety of git aliases like:
## git log aliases
#
# p -> --patch
# o -> --oneline
# r -> --reverse
# s -> --stat
# 1 -> -n1
# m -> master..
# om -> origin/master..
dom = diff origin/master..
doom = diff origin/master..
rbiom = rebase -i origin/master
lp = log -p
lo = log --oneline
lo1 = log --oneline -n1
lr = log --reverse
lm = log master..
lrm = log --reverse master..
lor = log --oneline --reverse
lorm = log --oneline --reverse master..
lorom = log --oneline --reverse origin/master..
lom = log --oneline master..
loom = log --oneline origin/master..
l1 = log -n1
...Somewhat more seriously, I haven't had to worry about typing 'git git' because I haven't typed 'git' on a daily basis in years. I think I've probably typed it once in the last month.
I didn't want to ruin my chances by correcting him that side-effects and idempotence refer to different qualities.
I passed the interview, but I've never forgotten that. The guy also seemed to have washed into the interview off his surf board.
Oh well. It was a very major company, so I let it all go.
One notable example: Stripe's "idempotency keys": https://stripe.com/blog/idempotency
On a side note, the founders of Google once tried to explain recursion and idempotence to Terry Gross on NPR. It's pretty amusing. It starts at 13:45 into the interview here:
http://www.npr.org/2003/10/14/167643282/google-founders-larr...
> git git pull
git: 'git' is not a git command. See 'git --help'.
The most similar command is
init
> fuck
git pull [enter/↑/↓/ctrl+c]https://en.wikipedia.org/wiki/Buffalo_buffalo_Buffalo_buffal...
$ gi tstatus
To fix this, I've added the following to my .bashrc: gi() {
args=("$@")
args[0]=${args[0]/t/}
git "${args[@]}"
}
It also works if you drop the "t" altogether.gi() { ARG=$(echo $1 | sed s/^t//); shift; git "$ARG" "$@"; }
Is the exec really required?
git config --global alias.git '!git'
Will also work. Am I missing something?EDIT: From git doc, "If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command"
So exec is not required then.
Also, I found one caveat from the same docs:
> Note that shell commands will be executed from the top-level directory of a repository, which may not necessarily be the current directory. GIT_PREFIX is set as returned by running git rev-parse --show-prefix from the original current directory.
So, if I have a modified file `bar` in subdirectory `foo` under project root, and I am currently in `foo`, git status will show:
modified: bar
but git git status will show: modified: foo/bar
To fix this, we should use cd first: git config --global alias.git '!cd "$GIT_PREFIX" && git'Seriously though, I don't understand why people want to hide obvious errors like this - I'd much rather have the tool fail to execute than potentially perform some action I wasn't expecting.
git config --global help.autocorrect 1
It will run the correct misspelled command after 100ms. For example git stauts will be corrected automatically to git status http://schacon.github.io/git/git-config.html
http://durdn.com/blog/2012/11/22/must-have-git-aliases-advan...
My version that works for my setup is `"!f() { git \"$@\"; }; f"`.
Hope this helps anyone who ran into the same issue, although I'm not 100% confident about the quoting.
EDIT: fixed the quoting, as per cryptonector's suggestion
EDIT2: need to quote the quotes for gitconfig to use it correctly
decorator = decorator(decorator)(decorator)
https://github.com/darius/sketchbook/blob/master/misc/decora...There was a subtle bug when leaving out the last (decorator). I know, it's very silly.
I also find "thefuck" is interesting but I love to control my fate :) (https://github.com/nvbn/thefuck)
alias gits='git status' git config --global alias.bomb '!git bomb & git bomb'
to make a fork bomb.Since then, I've found that these aliases have been the best workflow improvement I've ever made.
(It's especially pleasing to watch the system calls it generates via strace or dtrace!)
Works fine, but when I press quit (q), it says `error: exec git died of signal 13`
I take a minute, clear out distractions and then come back to what I'm working on.
printf("Hello, world!\n");
(printf)("Hello, world!\n");
(*printf)("Hello, world!\n");
(**printf)("Hello, world!\n");
(***printf)("Hello, world!\n");I suppose this is a problem with any alias.
$ \gstatus
gstatus: command not found
vs $ gstatus
git status stuff
The backslash just disables alias expansion. This works on all shells I'm aware of. It won't help with other portability concerns like actual missing commands though, of course.(is this really a thing?)
(get get get get)
to be equivalent to this one:
get
as in:
((get get get get) {:a 1} :a)
I was very excited about an article on this topic.