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 😎

[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"

Thank you, your answers have been sent
These will help me create more relevant content that you’re looking for.
Always stay up to date
I do not share data to anyone

I’ll only use the information you provide on this form to get touch about the topics you’ve chosen above. I do not share this data with anyone else.