gitconfig @ b09db0d33e13

More
author Steve Losh <steve@stevelosh.com>
date Tue, 14 Nov 2023 09:58:32 -0500
parents 96273ff110b3
children f864dc9b9822
[user]
    name = Steve Losh
    email = steve@stevelosh.com

[core]
    pager = cat
    editor = nvim
    excludesfile = ~/.gitignore

[alias]
    mainbranch = "!f() { git branch | grep -P ' (master|main)$' | sed -Ee 's/.* //'; }; f"
    tags = tag -l
    branches = branch -a
    remotes = remote -v

    make-the-fucking-branch-point-at-the-fucking-commit = "!sh -c 'git checkout $1 && git reset --hard $2' -"
    mtfbpatfc                                           = "!sh -c 'git checkout $1 && git reset --hard $2' -"

    reset-main-to-origin = "!sh -c 'git mtfbpatfc $(git mainbranch) origin/$(git mainbranch)' -"

    repoint = "!sh -c 'git update-ref HEAD $1 && git reset' -"

    root = rev-parse --show-toplevel

    l   = log -18 --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset'
    ll  = log     --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset'
    gl  = log -12 --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(by %an)%Creset%C(auto)%d%Creset%n'
    gll = log     --color=always --all --graph --topo-order --pretty='format:%Cgreen%h%Creset %s %C(black bold)(%cr by %an)%Creset%C(auto)%d%Creset%n'

    pull = pull --ff-only
    up = merge --ff-only
    update = merge --ff-only

    join = merge --no-ff

    discard-merge = reset --hard HEAD

    ack = log --color=always --all --topo-order --pretty='format:%Cgreen%h%Creset %s%Cred%d%Creset %C(black bold)(by %an)%Creset' --full-history -S

    # not much what's up with you
    upsub = submodule update --init --recursive

    ci = commit
    cm = commit -m

    d = diff
    di = diff --cached
    dl = "!f() { git diff \"$@\" | nvim -R -c 'set ft=diff' -; }; f"
    dil = "!f() { git diff --cached \"$@\" | nvim -R -c 'set ft=diff' -; }; f"

    co = checkout --recurse-submodules
    id = rev-parse

    stat = status
    st = status

    unstage = reset HEAD
    uns = reset HEAD

    shelve = stash save --include-untracked
    unshelve = stash pop

    shel = shelve
    unshel = unshelve

    delete-local-branch = branch -D
    delete-local-reference-to-remote-branch = "!sh -c 'git branch -rd $1/$2' -"
    delete-remote-branch = "!sh -c 'git push $1 --delete $2' -"
    delete-branch = "!sh -c 'git delete-local-branch $1; git remotes | cut -f1 | sort | uniq | xargs -n1 -I % git delete-local-reference-to-remote-branch % $1' -"
    delete-current-branch = "!bash -c 'git checkout master && git delete-branch $1' - $(git current-branch)"
    purge-branch = "!sh -c 'set -x; git delete-local-branch $1; git delete-local-reference-to-remote-branch origin $1 && git delete-remote-branch origin $1' -"
    clean-local-branches = "!sh -c 'git branch --merged master | grep -v master$ | xargs git branch -d' -"
    clean-remote-tracking-branches = "!sh -c 'git branch -r --merged master | grep -v /master$ | xargs git branch -rd' -"
    clean-branches = "!sh -c 'git checkout master && git fetch origin && git merge --ff-only origin/master && git clean-local-branches && git clean-remote-tracking-branches' -"

    branch-activity = "!sh -c 'git log -n1 --pretty=format:\"%aI%d\n\" $1 --' -"

    current-branch = rev-parse --abbrev-ref HEAD

    fo = fetch origin
    fu = fetch upstream

    po = push origin
    pu = push upstream

    mo = !git merge --no-ff origin/`git current-branch`
    mu = !git merge --no-ff upstream/`git current-branch`

    uo = !git merge --ff-only origin/`git current-branch`
    uu = !git merge --ff-only upstream/`git current-branch`

    fuu = "!sh -c 'git fu && git uu' -"
    fuo = "!sh -c 'git fo && git uo' -"
    fuom = "!sh -c 'git co $(git mainbranch) && git fo && git uo' -"
    fuum = "!sh -c 'git co $(git mainbranch) && git fu && git uu' -"
    rom =  "!sh -c 'git fo && git rebase origin/$(git mainbranch)' -"
    recon =  rebase --continue

    addremove = !git add . && git add -u
    addrem = !git addremove

    sl = "!sh -c 'git show --color=always $1 | less -R' -"

    find-merge = "!sh -c 'git log $1..master --merges -n1' -"

    import-patch = am

    untracked = "!sh -c 'git status -s | grep -E '''^[?][?] '''' | cuts -f2"
    purge = "!sh -c 'git untracked && confirm && git actually-purge'"
    actually-purge = "!sh -c 'git untracked | xargs rm'"

    bazel-log = log --pretty=bazel --date=raw --all --graph --topo-order 

[push]
    default = current

[color]
    branch = auto
    diff = auto
    interactive = auto
    status = auto

[merge]
    tool = splice

[mergetool "splice"]
    cmd = "nvim -f $BASE $LOCAL $REMOTE $MERGED -c 'SpliceInit'"
    trustExitCode = true

[mergetool "unity"]
    trustExitCode = false
    cmd = '/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"

[web]
    browser = open

[include]
    path = ~/.gitconfig_local

[credential]
    helper = store
    useHttpPath = false

[credential "https://github.com"]
    username = sjl

[sendemail]
    smtpserver = "/home/sjl/src/dotfiles/bin/msmtp-stevelosh"

[pretty]
    bazel = %C(auto)%H %Cgreen%cd %C(auto)%s %Cred%al %C(auto)%d

[pull]
	ff = only

[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true

[diff "lfs"]
	textconv = cat