Setup aliases and shortcuts for git commands

Here is how you setup aliases and shortcuts for git commands. Edit .gitconfig file in your $HOME directory.

[alias]
  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

Refer to the branch you've checked out when you use git push and/or git pull

[push]
  default = current

Here are some more goodies in your aliases list. Thank me later :sunglasses:

[alias]
  # Adds and commits files with a single command
  add-commit = !git add -A && git commit

  # Delete all local branches but master and the current one, only if they are fully merged with master.
  br-delete-useless = "!f(){\git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\}; f"

  # Delete all local branches but master and the current one.
  br-delete-useless-force = "!f(){\git branch | grep -v "master" | grep -v ^* | xargs git branch -D;\}; f"

What is this Site?

viralpatel.blog is started by me, Viral Patel, as a place to write posts and blogs about problems that I personally face during my day to day and share new learnings about software development work. Even though there is abundant of information out there via various personal blogs or blogs written by technical companies, day in and day out, We as software developers face different problems. By starting out this blog, I wish to explore different problem solving patterns and software design practices that will make easier to build quality and useful software.