Useful shell aliases
Here are a few useful shell aliases for common Git commands. Feel free to add these to your ~/.bash_aliases
file (presuming you’re using Bash):
alias gpo='git push origin $(git branch | grep "*" | cut -d " " -f2)'
alias gp='git pull'
alias gs='git status'
alias gd='git diff'
alias gds='git diff --staged'
If you’re typing in git status
dozens of times each day, it can be a huge improvement to add an alias that enables you to type gs
instead. Feel free to change these to something even more convenient – that’s what customization is for!
Now let’s zoom out a bit and see how we can practically apply all of this knowledge while building a small Linux server project: your very own private Git server.