Skip to content

Instantly share code, notes, and snippets.

@dnery
Last active December 7, 2023 01:30
Show Gist options
  • Save dnery/20867de1408110987c29c94817a4503f to your computer and use it in GitHub Desktop.
Save dnery/20867de1408110987c29c94817a4503f to your computer and use it in GitHub Desktop.
My git config file with cute handy aliases
[user]
email = EDIT
name = EDIT
[core]
editor = vim
[push]
default = simple
[alias]
co = checkout
st = status
br = branch
ci = commit
pl = pull
ps = push
lo = log --oneline
ru = remote update
brv = branch -v -v
rom = rebase origin/master
rod = rebase origin/develop
psf = push --force-with-lease
rub = !git remote update && git branch -v -v
cap = !git commit -a --amend && git push --force-with-lease
compare = "!f() { \
git branch | tr -d ' '| tr -d '*' | while read -r branch_name; do\
if [ \"$branch_name\" != 'develop' ]; then\
echo \"---> $branch_name\";\
git diff --stat \"origin/develop...${branch_name}\";\
fi;\
done;\
};\
f"
wayback = "!f() { git diff --name-status HEAD~\"$1\" HEAD; }; f"
# stash manipulation
sp = stash push
sa = stash apply
# log and branch visualization helpers
head = !git log --oneline | head
tail = !git br | tail
# Move untracked files to '.stash' directory in user home
lclean = "!f() { \
[ -d ~/.stash ] || mkdir ~/.stash; \
git ls-files --others --exclude-standard | while read -r filename; do \
mv \"$filename\" ~/.stash; \
done; \
}; \
f"
# Move untracked files from '.stash' back into wd
lrepop = "!f() { \
[ -d ~/.stash ] || mkdir ~/.stash; \
for filename in ~/.stash/*; do \
mv \"$filename\" .; \
done; \
}; \
f"
[diff]
tool = p4merge
[difftool "p4merge"]
cmd = "p4merge $LOCAL $REMOTE"
[merge]
tool = p4merge
# Download: https://www.perforce.com/downloads/visual-merge-tool
# Install pt1: extract tarball, move bins to /usr/local/bin and libs to /usr/local/lib
# Install pt2: on Ubuntu, install qt5-default package if you get "...application failed to start..."
[mergetool "p4merge"]
cmd = "p4merge $BASE $LOCAL $REMOTE $MERGED"
trustExitCode = false
keepTemporaries = false
keepBackup = false
prompt = false
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment