git/config
Kenneth Benzie (Benie) 854df7bc22 Add unamend alias to help reversing an amend
* `unamend` applies the diff from a previous `commit --amend` to the
working tree to make it easy to undo an accidental amend.
* Removed `last` alias, use `checkout -` instead
* Rename `name` alias to `refname` to be less ambiguous
2019-02-06 14:12:40 +00:00

63 lines
1.4 KiB
Plaintext

# vim: ft=gitconfig
[alias]
abandon = !git reset --hard HEAD && git clean -d -f
unstage = reset -q HEAD --
amend = commit --amend
unamend = !git diff $(git reflog -2 | \
awk \"{print \\$1}\" | \
sed -e ':a' -e 'N' -e '$!ba' -e 's/\\n/../g') | \
git apply - 2> /dev/null || \
echo \"error: last commit was not amended\"
fixup = commit --fixup
squash = commit --squash
prepare = rebase -i --fork-point
list = branch
create = checkout -b
delete = branch -D
refname = rev-parse --abbrev-ref HEAD
publish = !git push -u origin `git refname`
unpublish = !git push -u origin :`git refname`
force = push --force-with-lease
changes = !sh -c 'git log --oneline $1..' --
touched = diff-tree --no-commit-id --name-only -r
tree = log --graph --abbrev-commit --oneline --decorate \
--format=format:'%C(yellow)%h%C(reset) %C(blue)%aD%C(reset) %C(green)(%ar)%C(reset)%C(bold)%d%C(reset)%n %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
save = commit -am "temp!"
load = !sh -c '[ \"temp!\" = \"`git show --format=%s --no-patch`\" ] && \
git reset --mixed HEAD~ || echo \"error: commit subject is not: temp!\"'
[commit]
verbose = true
[core]
editor = vim
excludesfile = ~/.config/git/excludes
[fetch]
prune = true
[help]
autocorrect = -1
[pager]
status = true
[push]
default = simple
[rebase]
autoSquash = true
[user]
useConfigOnly = true
[include]
path = ~/.config/private/gitconfig
path = ~/.config/work/gitconfig