git runs fine with the default config. Still, when using it often, you'll find yourself repeating the same commands again and again. Here are my shortcuts.

Git configuration

[color "status"]
  changed = red bold
  untracked = red bold
  added = green bold
[core]
  autocrlf = input
  editor = nvim
[alias]
  cm = "!f() { git add -A . && git status && echo 'Proceed with commit? (y/n)' && read ans && [ "$ans" = 'y' ] && git commit -m \"$*\" && git push; }; f"
  co = checkout
  nbr = "!f() { git checkout -b $1 && git push -u origin $1; }; f"
  rmbr = "!f() { if [ "$(git symbolic-ref --short HEAD)" = "$1" ]; then echo 'Cannot delete the current branch. Please switch to a different branch first.'; else git branch --list $1 && echo 'Delete branch $1? (y/n)' && read ans && [ "$ans" = 'y' ] && git branch -d $1 && (git ls-remote --exit-code --heads origin $1 > /dev/null 2>&1 && git push origin --delete $1 || echo 'Remote branch not found, only local branch deleted'); fi; }; f"
[pull]
  rebase = true
[init]
  defaultBranch = main
[user]
  name = <your name>
  email = <your email>
  • git cm stages everything, asks for confirmation, commits with a message, and pushes.
  • git co is shorthand for checkout.
  • git nbr creates a new branch locally and remotely.
  • git rmbr removes a branch in both places, with a safety check to avoid deleting the current branch.