[core] editor = nvim commentchar = ";" quotepath = false [advice] detachedhead = false skippedcherrypicks = false [help] autocorrect = prompt [color] ui = true [column] ui = auto [tag] sort = version:refname [commit] status = false [fetch] prune = true prunetags = true all = true [pull] rebase = true [merge] tool = vimdiff ff = false conflictstyle = zdiff3 [mergetool "vimdiff"] cmd = "__fn() { \ if [ -z \"$BASE\" ]; then \ nvim -d -c 'wincmd l' \"$LOCAL\" \"$MERGED\" \"$REMOTE\"; \ else \ nvim -d -c '4wincmd w | wincmd J | diffoff' \"$LOCAL\" \"$BASE\" \"$REMOTE\" \"$MERGED\"; \ fi; \ }; __fn" [rebase] abbreviatecommands = true autosquash = true autostash = true updaterefs = true [rerere] enabled = true autoupdate = true [diff] algorithm = histogram colormoved = plain mnemonicprefix = true renames = true tool = vimdiff [difftool "vimdiff"] cmd = "nvim -R -d -c 'wincmd l' -c 'cd $GIT_PREFIX' \"$LOCAL\" \"$REMOTE\"" [init] defaultbranch = main [blame] coloring = repeatedLines [mergetool] keepbackup = false [credential "https://github.com"] helper = !gh auth git-credential [credential "https://gist.github.com"] helper = !gh auth git-credential [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true [alias] a = add ap = add -p b = branch current-branch = rev-parse --abbrev-ref HEAD c = commit fetch1 = fetch --depth=1 fixup = commit --fixup amend = commit --amend --no-edit clone1 = clone --depth=1 swc = switch -c swm = "!__fn() { \ if git rev-parse --verify --quiet main > /dev/null 2>&1; then \ git switch main \"$@\"; \ elif git rev-parse --verify --quiet origin/main > /dev/null 2>&1; then \ git switch -d origin/main \"$@\"; \ elif git rev-parse --verify --quiet master > /dev/null 2>&1; then \ git switch master \"$@\"; \ elif git rev-parse --verify --quiet origin/master > /dev/null 2>&1; then \ git switch -d origin/master \"$@\"; \ else \ echo 'error: no branch found' >&2; \ fi; \ }; __fn" swd = "!__fn() { \ if git rev-parse --verify --quiet develop > /dev/null 2>&1; then \ git switch develop \"$@\"; \ elif git rev-parse --verify --quiet origin/develop > /dev/null 2>&1; then \ git switch -d origin/develop \"$@\"; \ else \ echo 'error: no branch found' >&2; \ fi; \ }; __fn" d = diff dc = diff --cached g = grep gf = grep --name-only s = status --short wip = commit -a -m "wip" cwip = commit -m "wip" swip = stash save "wip" sswip = swip ss = stash save ssl = stash list ssa = stash apply ssd = stash drop ssp = stash pop tags = tag last = log --pretty=fuller -1 l = "!__fn() { \ local last_merge_commit=\"$(git last-merge-commit)\"; \ if [ -n \"$last_merge_commit\" ]; then \ git log --oneline --boundary \"$last_merge_commit\".. \"$@\"; \ else \ git log --oneline -n 10 \"$@\"; \ fi; \ }; __fn" ll = log --oneline logf = log --pretty=fuller graph = log --oneline --graph r = rebase ri = rebase -i rid = rebase -i develop rc = "!GIT_EDITOR=true git rebase --continue" re = restore rep = restore -p m = "!__fn() { \ if [ \"$1\" = --abort ]; then \ git merge --abort; \ else \ git merge --no-edit \"$@\"; \ fi; \ }; __fn" mc = "!GIT_EDITOR=true git merge --continue" mm = mergetool pullu = pull upstream HEAD --ff pullo = pull origin HEAD --ff pusho = push origin HEAD cpick = cherry-pick cpickc = "!GIT_EDITOR=true git cherry-pick --continue" empty = commit --allow-empty last-merge-commit = "!git rev-list --abbrev-commit --merges HEAD | head -n 1" config-user = "!__fn() { \ if [ \"$1\" = nsfisis ]; then \ git config user.name nsfisis && git config user.email nsfisis@gmail.com; \ elif [ \"$1\" = \"\" ]; then \ echo \"usage: git config-user \" >&2; \ else \ echo \"unknown user: $1\" >&2; \ fi; \ }; __fn" setup-hooks = "!cp ~/dotfiles/githooks/* \"$(git rev-parse --show-toplevel)/.git/hooks\"" init-empty = "!__fn() { \ if [ \"$1\" = \"\" ]; then \ echo \"usage: git init-empty \" >&2; \ else \ git init . && git config-user \"$1\" && git empty -m \"\"; \ fi; \ }; __fn" ignore = "!__fn() { \ if [ \"$1\" = \"\" ]; then \ echo \"usage: git ignore \" >&2; \ else \ echo \"$1\" >> \"$(git rev-parse --git-dir)/info/exclude\"; \ fi; \ }; __fn" sync-upstream = "!__fn() { \ if [ \"$1\" = \"\" ]; then \ local branch=\"$(git current-branch)\"; \ else \ local branch=\"$1\"; \ fi; \ if git rev-parse --verify --quiet \"origin/$branch\" > /dev/null 2>&1 && \ git rev-parse --verify --quiet \"upstream/$branch\" > /dev/null 2>&1; then \ git branch --force \"$branch\" \"upstream/$branch\" && \ git push --force-with-lease origin \"$branch\"; \ else \ echo \"error: branch '$branch' not found on both origin and upstream\" >&2; \ exit 1; \ fi; \ }; __fn" backup-branch = "!__fn() { \ if [ \"$1\" = \"\" ]; then \ local branch=\"$(git current-branch)\"; \ else \ local branch=\"$1\"; \ fi; \ local sha=$(git rev-parse --short \"$branch\"); \ local backup_branch=\"bak/$branch/$sha\"; \ if ! git rev-parse --verify --quiet \"$backup_branch\" > /dev/null 2>&1; then \ git branch \"$backup_branch\" \"$branch\"; \ fi; \ }; __fn"