Created
June 27, 2018 14:41
-
-
Save thatandromeda/38fb1546b8f04133b0a61dfd0d6936ae to your computer and use it in GitHub Desktop.
git cleanup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This alias lets you use "git cleanup" in the following scenario: | |
# - you're on a branch | |
# - that branch just got merged on the remote | |
# - you would like to switch to master, update it, and delete your now-useless local branch | |
# - you don't want to type three almost-identical commands every time you do this thing you do all the time | |
# Yay! Now you can do the thing in two words. | |
[alias] | |
cleanup = "!f() { branch_name=$(git rev-parse --abbrev-ref HEAD); git checkout master; git branch -D ${branch_name}; git pull;}; f" |
Yay, I'm glad it works for you!
Also useful for me:
derpsquish = "!git add . && git commit -a --amend -C HEAD"
(This is for when you committed some stuff, then made a couple of changes that you immediately thereafter thought of which belonged in that commit. It replaces git commit -am"Earlier commit message"
, git commit -am"derp"
, then squashing the commits.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I love this one. Thanks for sharing.