Skip to content

Instantly share code, notes, and snippets.

@agirault
Last active March 26, 2024 16:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agirault/a69a7eb5862d479e68b92eef8840e5d9 to your computer and use it in GitHub Desktop.
Save agirault/a69a7eb5862d479e68b92eef8840e5d9 to your computer and use it in GitHub Desktop.
Some git aliases
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[user]
name = Alexis Girault
[alias]
graph = log --graph --decorate --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lg = graph --first-parent
merges = lg --merges
amend = commit --amend --no-edit
amend-author = amend --author="$1"
unstage = restore --staged
fixup = "!REV=$(git rev-parse $1) && git commit --fixup $REV && (GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash --autostash --rebase-merges --no-fork-point $REV^ || (git diff && git rebase --abort && git reset --soft HEAD^ && echo "Rebase aborted")) #"
fix = fixup
f = fixup
branch-delete-merged = !git branch --merged | grep -Ev \"(^\\*|^\\s+master$)\" | xargs git branch -d
rename = branch -m
head = rev-parse HEAD
sha = rev-parse --short
bblame = blame -w -C -C -C
s = status
a = add
aa = add --all
rb = rebase
rbi = rebase --interactive
rba = rebase --abort
rbc = rebase --continue
cp = cherry-pick
cpa = cherry-pick --abort
cpc = cherry-pick --continue
cps = cherry-pick --skip
cm = commit
cmm = commit --message
p = push origin HEAD
pf = p --force
ch = checkout
chb = checkout -b
new = chb
rs = reset
rsa = reset --hard
rss = reset --soft
d = difftool
sync = !r=${1:-origin} && b=$(git rev-parse --abbrev-ref HEAD) && git fetch $r $b && git rsa $r/$b
track = branch --set-upstream-to=${1:-origin}/$(git branch --show-current) $(git branch --show-current)
[commit]
verbose = true
[push]
default = current
followTags = true
autoSetupRemote = true
[rebase]
autosquash = true
autoStash = true
[core]
editor = vim
autocrlf = false
safecrlf = false
[diff]
# external = difft # use as difftool instead
tool = difftastic
[difftool]
prompt = false
[difftool "difftastic"]
cmd = difft "$LOCAL" "$REMOTE"
[pager]
difftool = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment