Skip to content

Instantly share code, notes, and snippets.

@jakiestfu
Last active July 30, 2019 19:51
Show Gist options
  • Save jakiestfu/74de496e651e0cffc50d to your computer and use it in GitHub Desktop.
Save jakiestfu/74de496e651e0cffc50d to your computer and use it in GitHub Desktop.
Useful Git Aliases
# Git Destroy
# Deletes a branch locally and on the origin
# git destroy <branch>
git config --global alias.destroy '!g() { git branch -D $1 && git push origin $1 --delete; }; g'
# Git Circle CI
# Opens the projects builds in Circle
# git cci
git config --global alias.cci '!g() { branch=`git rev-parse --abbrev-ref HEAD`; top_level=`git rev-parse --show-toplevel`; repo=`basename $top_level`; url="https://circleci.com/gh/MakerStudios/$repo/tree/$branch"; open $url; }; g'
# Git Remote Diff
# Opens the projects latest diff in GitHub
# git rdiff
git config --global alias.rdiff '!g() { origin=$(git config --get remote.origin.url | sed "s/git@/https:\/\//g" | sed "s/.com:/.com\//g"); url=${origin/.git/\/commit\/$(git rev-parse HEAD)}; open $url; }; g'
# Git Refresh
# Rebases your branch off of master and pushes upstream
# git refresh
git config --global alias.refresh '!g() { git checkout master && git pull && git checkout - && git rebase - && git push -f }; g'
# Git Fabulous
sudo gem install lolcat
git config --global alias.fab '!g() { git status | lolcat; }; g'
git config --global alias.fabulous '!g() { git status | lolcat; }; g'
# Shortcuts
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment