> git config --global help.autocorrect 1
Based on bash history data, I've also added a simple alias to my bash config:
> alias gti="git"
[1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configura...
> git config --global help.autocorrect 1
Based on bash history data, I've also added a simple alias to my bash config:
> alias gti="git"
[1]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configura...
With zsh: "history 1 | awk '{print $2}' | sort | uniq -c | sort -n"
With bash I think this should be "history" instead of "history 1".
I change this:
HISTSIZE=1000
HISTFILESIZE=2000
to: HISTSIZE=1000000
HISTFILESIZE=2000000
You would be surprised how useful this one change has been, answering historical questions easily, like how to generate that rsa key, or what packages did I install for that project last year.You can usuall answer questions with ^r instead of the man page. Or maybe:
"history | grep -C 10 <foo>"Well for all of these people: I recently found Lazygit (https://github.com/jesseduffield/lazygit) which is a terminal UI for git and that does exactly what I've been looking for all these years, down to vim-like keybindings!
The true power of CLI apps comes from "alias" commands that you build up yourself. The following commands are great examples of this:
alias docker-kill-all='docker kill `docker ps -aq`'
alias docker-rm-all='docker rm `docker ps -aq`'
After a while I've learnt that a gui or cli-gui can never compose as well as the terminal can...> The true power of CLI apps comes from "alias" commands that you build up yourself
I usually agree. I spent way too many hours making aliases and I'm very proficient at it. But sometimes there's something like lazygit which does everything my aliases did, but slightly better as it gives me, for example, line-by-line staging and vim keybindings.
It is true that it does not compose, but I can still (and do) use the command line. It's just a nice increase of productivity in 90% of the cases (for me!)
Note: I'm not related to the lazygit project in any way, just very satisfied with it
Visual walk through: https://emacsair.me/2017/09/01/magit-walk-through/
> alias g="git"
Genuinely interested, why?
I'm a huge fan of the CLI in general, but for some things it just slows me down, git usage is one of those.
Random example: reverting a commit is 2-3 clicks, or a whole lot of typing.
They usually don't support the level of granularity I have on the CLI. For example, if I want to fix a commit on a PR based on feedback I've received, I can make the fix and `git rebase -i` will let me amend any of my previous commits (via 'fixup'). None of the IDEs I've tried support it; it's possible instead of an IDE one of the dedicated git tools like Kraken support this?
It's also just mildly terrifying when the IDE gives you a button with no further explanation for what it's actually doing. I.e. what do 'refresh' and 'sync' do in VS Code? The consequences could be dire: https://github.com/microsoft/vscode/issues/32405
> reverting a commit is 2-3 clicks, or a whole lot of typing.
Git revert is a single command; finding the commit to revert is the hard part. `git bisect` makes this easy, and I haven't seen any IDEs nail that one. That said, this is a rare use case.
git log
git revert {hash}
I'd hardly call that a whole lot of typing. It's roughly equivalent to 2-3 clicks in a GUI app.Where the GUI falls down for me is more complicated things, like hard resetting a branch to origin or resolving merge conflicts.
Also, most of the git guis do things that I find distressing. For example, in one git GUI I tried a while back, I accidentally dragged a commit onto a branch listed in the sidebar. Only later did I realize the gui cherry-picked the commit into the branch without asking me for confirmation. It would do similar things if I dragged one branch into another.