Skip to content

Instantly share code, notes, and snippets.

@Teemu
Last active May 29, 2019 09:30
Show Gist options
  • Save Teemu/b839d573f2326e9e0055eec9aa4646f9 to your computer and use it in GitHub Desktop.
Save Teemu/b839d573f2326e9e0055eec9aa4646f9 to your computer and use it in GitHub Desktop.
List of useful aliases
alias gpu='git push -u origin $(git symbolic-ref --short HEAD)'
alias gitbackup='git checkout -b backup/`git rev-parse --abbrev-ref HEAD`/`date +%Y%m%d-%H%M%S` && git checkout -'
alias acommit='git add -A :/ && git commit -a'
alias changedfiles='git diff --name-status master..`git rev-parse --abbrev-ref HEAD`'
alias rebasemaster='git checkout master && git pull && git checkout - && git rebase master'
alias updatebranch='git fetch && git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)'
alias changed='git diff HEAD'
alias gitbranch="git for-each-ref --color=always --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -15"
killport () {
if [ -z "`lsof -i tcp:${1:-5000}`" ]
then
echo "\e[31mNo processes found.\e[0m"
else
lsof -i tcp:${1:-5000}|awk '{ print $2 }' |grep -v 'PID'|xargs kill
echo "Process killed."
fi
}
alias lock="/System/Library/CoreServices/Menu\ Extras/user.menu/Contents/Resources/CGSession -suspend"
sublime_as_editor () {
export GIT_EDITOR='"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" -n -w'
echo "Exported!"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment