Skip to content

Instantly share code, notes, and snippets.

@OOPMichael
Last active June 7, 2023 19:55
Show Gist options
  • Save OOPMichael/6ec631a81da9db771afaef9bb696904c to your computer and use it in GitHub Desktop.
Save OOPMichael/6ec631a81da9db771afaef9bb696904c to your computer and use it in GitHub Desktop.
update email/squash-master
[user]
name = Michael Allen
email = michael.allen.development@gmail.com
[alias]
#because why type more if you have too?
st = status
co = checkout
cob = checkout -b
cm = !git add -A && git commit -m
save = !git add -A && git commit -m 'SAVEPOINT'
amend = commit -a --ammend
#squash all commits from master
squash-master = reset $(git merge-base master $(git branch --show-current))
##minor screw-up move back a space
re-roll = git add . && git stash -all
#you screwed up your workspace make a commit, reset to head, and leaves a commit 'orphaned' which can only be found via reflog
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
#alternatively you don't care abous saving your changes...
undo = !git add -A && git reset --hard && git pull
#from git aliases of the gods
stsh = stash --keep-index
staash = stash --include-untracked
staaash = stash --all
#'pretty print git log --graph'
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = ! git lg1
#add/commit all working changes, fetch a PR branch (by number) and check it out.
review = git add . && git commit -m "[WIP]" && git fetch origin pull/$1head:PR$1 && git checkout PR$1
#'NIX ONLY
#clean up feature branches after a merge to master
bclean = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$ " | xargs git branch -d; }; f"
#DANGER! DELETE local branch and origin
destroy = !g() {git branch -D $1 && git push origin $1 --delete;}; g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment