Skip to content

Instantly share code, notes, and snippets.

@Kjaer
Forked from salimkayabasi/.gitconfig
Last active September 15, 2023 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kjaer/f46e0f0d9352852733dfa1f02add8d2d to your computer and use it in GitHub Desktop.
Save Kjaer/f46e0f0d9352852733dfa1f02add8d2d to your computer and use it in GitHub Desktop.
# credit: http://haacked.com/archive/2014/07/28/github-flow-aliases/
[user]
name = Halil Kayer
email = kayer.halil@gmail.com
signingkey = 60C52C88E94A6EB1
[core]
editor = micro
pager = delta
excludesfiles = /Users/u132515/.gitignore
[commit]
gpgsign = true
[tag]
gpgsign = true
[gpg]
program = gpg2
[color]
diff = auto
status = auto
branch = auto
ui = true
[color "diff"]
meta = yellow bold
commit = green bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
st = status -sb
ci = commit
co = checkout
br = branch
cp = cherry-pick
up = pull --rebase
ff = pull --ff-only
graph = log --graph --branches --remotes --tags --ignore-all-space --format=format:'%Cgreen%h %Creset• %<(75,trunc)%s (%cN, %cr) %Cred%d' --date-order
hist = log --abbrev-commit --decorate --ignore-all-space --format=format:'%C(bold blue)%h%C(reset) - %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'
history = log --graph --abbrev-commit --decorate --date=relative --ignore-all-space --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --ignore-all-space
ls-subtrees = !"git log | grep git-subtree-dir | awk '{ print $2 }'"
pop = stash pop
override = !sh -c 'echo git add -- $0 && echo git reset HEAD -q -- $0 && echo git checkout -- $0'
wu = log --stat origin..@{0}
unadd = rm --cached
sup = !git stash && git up && git pop
sff = !git stash && git ff && git pop
# force stash pop to apply, even if there are uncommitted changes
popf = !git stash show -p | git apply && git stash drop
applyf = !git stash show -p | git apply
# check if a branch has been merged into the current HEAD
merged = !sh -c 'git rev-list HEAD | grep $(git rev-parse $0)'
# git svn aliases
srebase = !git stash && git svn rebase -l && git stash pop
sdcommit = !git stash && git svn dcommit && git stash pop
# move the last commit to a new branch
rebranch = !sh -c 'git stash && git branch $0 && git reset --hard HEAD^ && git checkout $0'
# update commit timestamp on last commit
update-timestamp = commit --amend --reset-author --no-edit
purge-remote = !sh -c 'echo git branch -a | echo sed -n \"/master$/d;s?^ *remotes/$0/??p\"'
root = rev-parse --show-toplevel
current-branch = rev-parse --abbrev-ref HEAD
recent-branches = branch --sort=-committerdate
co-recent = !git branch --sort=-committerdate | fzf +s | xargs -r git checkout
# diff-highlight
diffh = !sh -c 'git diff --color | diff-highlight'
diffhf = !sh -c 'git diff --color | diff-highlight | diff-so-fancy'
gone = ! "git fetch --all -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}'"
gone-rm = ! "git fetch --all -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}' | xargs -r git branch -D"
# find origin of current local branch
which-origin = rev-parse --abbrev-ref --symbolic-full-name @{u}
# find where the current is off from - This line below depend on ripgrep tool. You need to install ripgrep first.
parent = ! "git show-branch | rg \"\\*\" | rg -v \"$(git rev-parse --abbrev-ref HEAD)\" | head -n1 | sed 's/.*\\[\\(.*\\)\\].*/\\1/' | sed 's/[\\^~].*//' "
[pager]
blame = delta
[interactive]
diffFilter = delta --color-only --show-syntax-themes --light
[delta]
navigate = true # use n and N to move between diff sections
line-numbers = true
side-by-side = true
hyperlinks = true
[merge]
conflictstyle = diff3
tool = smerge
[diff]
colorMoved = default
tool = smerge
[mergetool]
keepBackup = false
[mergetool "smerge"]
trustExitCode = true
cmd = smerge mergetool \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"
[difftool "smerge"]
cmd = smerge \"$BASE\" \"$LOCAL\" \"$REMOTE\"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment