Skip to content

Instantly share code, notes, and snippets.

@vjefri
Last active May 20, 2016 04:59
Show Gist options
  • Save vjefri/9b90a49a98900de41223256b513ef327 to your computer and use it in GitHub Desktop.
Save vjefri/9b90a49a98900de41223256b513ef327 to your computer and use it in GitHub Desktop.
# Easier navigation: .., ..., ...., ....., ~ and -
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
# Shortcuts
alias d="cd ~/Documents/Dropbox"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias fb="cd ~/floobits/HackReactor/"
alias ealias="cd ~ && subl .aliases"
alias egit="cd ~ && subl .gitconfig"
alias g="git"
alias h="history"
alias j="jobs"
# Detect which `ls` flavor is in use
if ls --color > /dev/null 2>&1; then # GNU `ls`
colorflag="--color"
else # OS X `ls`
colorflag="-G"
fi
# You can save so much time for really long commands that you use often.
# You can also have git commands.
# My Favorite
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume 7'"
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
# Pull in remote changes for the current repository and all its submodules
p = !"git pull; git submodule foreach git pull origin master"
# Add origin
radd = remote add origin // I added this one
# Add upstream
raddup = remote add upstream // and this one
# Pull and rebase remote changes for the current repository from master upstream
prum = pull --rebase upstream master
# Clone a repository including all submodules
c = clone --recursive
# Commit all changes
ca = !git add -A && git commit -av
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment