← Back to context

Comment by rectangletangle

7 years ago

I've tried out a few different GIT GUIs, and never really took to any of them. Settled for using the CLI + many BASH aliases. Anything I do frequently gets a concise alias to minimize typing. I have relatively short fingers, and I'm admittedly a pretty poor typist, so I really emphasize the concise part. Pretty much all the aliases are write only code. I do this for pretty much every other complex CLI application too, e.g., Docker, Heroku, AWS. A little abstraction really speeds up using the CLI. Aliases are my favorite feature of BASH, I think they've saved me literally months of typing at this point in my life.

Here's a few handy ones:

  alias currentbranch='git rev-parse --abbrev-ref HEAD'
  alias gpush='git push origin $(currentbranch)'
  alias gsync='git pull origin $(currentbranch)'

  alias ga='git add -A'
  alias gc='git checkout'
  alias gcm='git commit -m'
  alias gca='git commit --amend'

  # and my personal favorite (list recent branches)
  alias gb='git for-each-ref --sort=-committerdate refs/heads/ --format="%(HEAD) %(color:yellow)%(refname:short)%(color:reset)" | head -n 20'

My version of gsync is `git pull --rebase origin ${currentbranch}`, since I hate having random merge commits.