Aliasing Your Git Commands for Maximum Developer Efficiency
tutorialedge.net
tutorialedge.net
https://github.com/ohmyzsh/ohmyzsh?tab=readme-ov-file
https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...
Batteries included can be nice.
When your batteries start to run their own webservers and phone home, someone mistook convenience for batteries.
I'm pretty sure that omz is not running their own webserver (correct me if I'm wrong here). It is just doing a git pull to update. [1]
[1]: https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/upgrade...
ga = git add -A
gc = git commit
gcm = git commit -m
gp = git push
All of these are defined in my zshrc rather than doing it through git config.
alias ga="git add"
alias gaw="git add -A && git diff --cached -w | git apply --cached -R"
alias gb="git branch"
alias gbl="git branch -l"
alias gbD="git branch -D"
alias gbu="git branch -u"
alias gc="git commit"
alias gca="git commit -a"
alias gcaa="git commit -a --amend"
alias gcam="git commit -a -m"
alias gce="git commit -e"
alias gcfu="git commit --fixup"
alias gcm="git commit -m"
alias gco="git checkout"
alias gcob="git checkout -b"
alias gcoB="git checkout -B"
alias gcp="git cherry-pick"
alias gcpc="git cherry-pick --continue"
alias gd="git diff"
alias gd^="git diff HEAD^ HEAD"
alias gds="git diff --staged"
alias gl="git lg" # TODO - make these options defaults for "git log" itself
alias glg="git log --graph --decorate --all" # TODO - make these options defaults for "git log" itself
alias gdc="git diff --cached"
alias gpom="git push origin master"
alias gr="git remote"
alias gra="git rebase --abort"
alias grb="git rebase --committer-date-is-author-date"
alias grbom="grb --onto master"
alias grbasi="git rebase --autosquash --interactive"
alias grc="git rebase --continue"
alias grs="git restore --staged"
alias grv="git remote -v"
alias grh="git reset --hard"
alias grH="git reset HEAD"
alias grH^="git reset HEAD^"
alias gs="git status -sb"
alias gsd="git stash drop"
alias gsl="git stash list --date=relative"
alias gsp="git stash pop"
alias gss="git stash show"
alias gst="git status"
alias gstn="git status -uno"
alias gsu="git standup"
alias gforgotrecursive="git submodule update --init --recursive --remote"
Looking at the other posts in the thread, it looks like this set of aliases is very similar (maybe I should switch to cut some fat out of my dotfiles): https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...
I suppose that is true because I can't remember more than 3 of my shell git aliases but I'm the most basic git user you can get and I don't use them for work.
set -eux
git log --notes --decorate=full --source --stat --summary -C -M --pretty=fuller $*|less
...so that I can see if there was any revision to a commit after it was first committed, which files were changed and how much, and pass extra parameters if needed.
I usually use long form commands and parameters. I use ZShell history + FZF to get at commands with minimal keystrokes.
Don't really have to remember anything. Some vague snippets will narrow it down really fast.
```
s="git status"
d="git diff"
c="git diff --cached"
```
I have one other, `rb`, which uses a lot of intermediate work to print all the recent branches I've committed to with nice conditional formatting.Your axe doesnt need to be extra sharp so you can cut one extra tree in a day, it needs to be extra sharp so it feels good to chop down trees.
Actually, no, there is also "git_show_branch" because every time I needed that in the shell, I could never remember the proper incantation. Something to do with rev-parse or something?
For me, the seconds this saves in typing don't outweigh the annoyance of trying to pair with another developer who only uses their own special aliases.