Skip to content

Instantly share code, notes, and snippets.

@michael-ford
Last active March 4, 2025 00:56
Show Gist options
  • Save michael-ford/1e0b1f1478f371032df656f4fad35ab2 to your computer and use it in GitHub Desktop.
Save michael-ford/1e0b1f1478f371032df656f4fad35ab2 to your computer and use it in GitHub Desktop.
.gitconfig
[alias]
unstage = reset HEAD --
changed = "!git diff-tree --no-commit-id --name-only -r $2"
tree = log --graph --all --oneline
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
locate = ! git log --follow --all --remotes -3 --pretty=format:'%h' -- $1 | xargs -I_ git show --abbrev-commit --stat _
test = ! git log --follow --all --remotes -3 --pretty=format:'%h' -- "$1"
ss = "!f() { default=$(date '+Staged Stash: %Y-%m-%d %I:%M %p'); msg=${1-$default}; git stash push -m \"$msg\" -- $(git diff --staged --name-only); }; f"
diff-f = diff --name-status
cp = cherry-pick
snut = status -uno
ls = ls-tree --name-only
show-tracked = ls-tree --name-only HEAD
# rebases branch with its sub-branches (one level down)
# useage: git move <upstream> <branch>
# source: https://stackoverflow.com/a/66799544
move = "!mv() { git rebase $1 $2; git branch --format='%(refname:short)' --contains $2@{1} | xargs -n 1 git rebase --onto $2 $2@{1}; }; mv" #usage: git move <new-upstream> <branch>
ls-tracked = ls-tree -r HEAD --name-only
ls-untracked = ls-files . --exclude-standard --others
[core]
editor = nano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment