Live data from Hacker News

Aliasing Your Git Commands for Maximum Developer Efficiency

tutorialedge.net

1–10 of 31 posts

Re: Aliasing Your Git Commands for Maximum Developer Efficiency

#3
If you're interested, Oh my zsh already has git aliases and much more for dev productivity. It also has a really large number of supported plugins.

https://github.com/ohmyzsh/ohmyzsh?tab=readme-ov-file

https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...

Re: Aliasing Your Git Commands for Maximum Developer Efficiency

#7

thanks, I hate it. 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.

When you pair-program you’re reading their git prompts?

Re: Aliasing Your Git Commands for Maximum Developer Efficiency

#9
Eh. I've only ever aliased "git status -s | awk '$1 == "M" { print $2 }' | xargs -t git add" as "git_add_all": branch switching works well enough in VSCode, "git diff" shows you your commit preview perfectly fine, and shortening "git push" and "git commit" never really felt like a pressing concern.

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?

Re: Aliasing Your Git Commands for Maximum Developer Efficiency

#10

I have several git alias that I live by: 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.

Same thing - I put them in my shell. Here is the list I use:

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"

Post reply on HN