Skip to content

Instantly share code, notes, and snippets.

@MikeFoden
Created November 4, 2021 22:18
Show Gist options
  • Save MikeFoden/6700b209a0ace4f45459fad5eba39f3c to your computer and use it in GitHub Desktop.
Save MikeFoden/6700b209a0ace4f45459fad5eba39f3c to your computer and use it in GitHub Desktop.
Git Aliases
#!/bin/sh
# Easily amend a commit (and to not screw up when misspelling)
git config --global alias.amend = commit --amend --no-edit
git config --global alias.ammend = commit --amend --no-edit
# Remove untracked files
git config --global alias.scrub = clean -fx
git config --global alias.ajax = clean -fx
# Remove old branches
git config --global alias.boom = !git fetch origin --prune && git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -D
# Push branch to origin
git config --global alias.done = push -u origin HEAD
git config --global alias.o = fetch origin
git config --global alias.m = checkout main
git config --global alias.p = pull
git config --global alias.r = reset --hard HEAD
git config --global alias.ca = commit -a -m
# Quickly reset to main/master
git config --global alias.memain = !git o && git m && git r && git p
git config --global alias.memaster = !git o && git checkout master && git r && git p
# Update submodules
git config --global alias.superpull = submodule update --remote --merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment