Hacker News new | past | comments | ask | show | jobs | submit login

Here is my own DSL. Interesting that it turns out we have similar aliases...

    alias ga='git add'
    alias gb='git branch'
    alias gbD='gb -D '
    alias gbc='gc -b '
    alias gbd='gb -d '
    alias gc='git checkout'
    alias gcm='git checkout master'
    alias gd='git diff '
    alias gdd='gd --cached'
    alias gdm='gd master...'
    alias ge='git grep -InE '
    alias gec='git branch --remotes --contains '
    alias geh='git log --all --oneline --decorate -G '
    alias gei='ge -i'
    alias gff='gh && gpr && gr && ghp'
    alias gfm='b=$(gw) && [[ "$b" != master ]] && gcm && gpr && gfu && gr && gc $b && unset b'
    alias gfr='git fetch && git rebase origin/master'
    alias gfu='git fetch upstream && git merge upstream/$(gw)'
    alias gh='git stash'
    alias gha='gh -k'
    alias ghp='gh pop'
    alias ghs='gh show -p '
    alias gl='git log --graph --decorate --all'
    alias gll='gl --pretty=format:"%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s" --relative-date'
    alias glll='gl --color --graph --pretty=format:'\''%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset'\'' --abbrev-commit'
    alias gp='git pull '
    alias gpr='git pull origin $(gw)'
    alias gps='git push'
    alias gpt='gps --tags'
    alias gr='git push origin $(gw)'
    alias grr='git rebase -i HEAD~$(grrr | wc -l)'
    alias grrr='git rev-list master..'
    alias grt='gr --tags'
    alias gs='git status'
    alias gss='git show'
    alias gu='git config --get remote.origin.url'
    alias gv='git describe --abbrev --dirty --always --tags'
    alias gw='git rev-parse --abbrev-ref HEAD 2>/dev/null'
    alias gx='git archive --format tar --remote '

I especially like the "grr" and "grrr" aliases. I have those days too...

You might be interested in this:


It creates the aliases as you do, but also includes tab completion, and only takes effect when you're in a repository path.

If shell aliases don't tab-complete for you, you can get tab completion just by defining git aliases instead. One extra space if you also alias g=git. And it solves namespacing.

I meant that the alias `b` for `git branch` will have the same bash completion as `git branch`, e.g. branch names.

I don't know if it's the same in bash, but at least in zsh, "git branch <TAB>" and "b <TAB>" have the exact same result, if b is aliased to "git branch"; the first tab fills in the name of the branch, another lets me select a commit, and further tabs are command line options.

That would make sense!

Alas, that is not the case with bash.

Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact