Setup Git shortcuts (aliases)

I like to type short commands for commands I use very often. If you use Git, then you probably use that command a lot.

I have some shortcuts setup for git like this:

On Mac you can edit your .gitconfig file by typing nano ~/.gitconfig and add the following:

  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p

If you even want the git command shorter, then you can make an alias in your ~/.bash_profile file by typing nano ~/.bash_profile and adding the following:

alias g='git'

Now you can use git like this: g co -b feature/new-branch (creates a new branch).


Happy coding! – Found a mistake or a typo? Please submit a PR to my GitHub-repo.

Get my next post right in your inbox via Blogsend
(I don't get your email address so I can't spam you)

Like this post? Follow @adriaanvrossum on Twitter