Using Git's aliases feature

Git allows you to create aliases internally through the config. Your global config should be located here ~/.gitconfig

[alias]
  aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort
  count = shortlog -sn
  l = log
  co = checkout
  ca = commit -C HEAD --amend
  c  = commit
  cm = commit -m
  a  = add
  s  = status
  b  = branch
  p  = push
  mt = mergetool
  dt = difftool
  o  = origin
  rc = rebase --continue
  rs = rebase --skip
  pd  = !git checkout develop && git pull origin develop && git branch --merged | grep -v '*' | grep -v 'master' | xargs git branch -d && git fetch --prune origin
  pm  = !git checkout master && git pull origin master && git branch --merged | grep -v '*' | grep -v 'develop' | xargs git branch -d && git fetch --prune origin
  pr = pull-request -c -m


Most are self explanatory...

git pd (prune develop) - checks out to develop, fetches latest changes, deletes all stale branches except develop (will delete master too)

git pm (prune master) - does the same as prune develop for master

Joe

Get our stories delivered

From us to your inbox weekly.