Code Tip: My favorite terminal aliases

Here are a few aliases that make my life easier. Do you ever forget what the source command is?

alias push="git push -u origin HEAD" alias src="source ~/.zshrc" alias prune-repo='git branch | grep -ve " master$" | xargs git branch -D'

After creating a new git branch, the best way to push the branch up to the remote location is with this push command.

If you need to reload your terminal settings because you made a change to your .zshrc or .bashrc file, it's cumbersome to remember the source command. This src command saves some key strokes and you don't have to remember anything.

Sometimes, when you have checked out many Git branches, those branches will eventually go stale. It can be a slow process to checkout a branch that is thousands of commits behind master locally, when you know the remote branch is closer to, or even ahead of master. prune-git will delete all branches that are not master. Then, when you checkout any remote branch, you will get exactly what is in the remote.