gitconfig @ 291b07317431

Merge.
author Steve Losh <steve@stevelosh.com>
date Sat, 11 Aug 2018 18:14:18 +0000
parents 3f66d0d6e710
children 5c7c7f2d7904
[user]
    name = Steve Losh
    email = steve@stevelosh.com

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

[alias]
    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' -"
    root = rev-parse --show-toplevel

    graft = cherry-pick -x

    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(yellow bold)%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(yellow bold)%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

    ci = commit
    cm = commit -m

    d = "!sh -c 'git diff $* | nvim -R -' -"
    di = !git diff --cached | nvim -R -
    dl = !git diff | nvim -R -c 'set ft=diff' -

    co = checkout
    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 delete-local-reference-to-remote-branch origin/$1; git delete-local-reference-to-remote-branch upstream/$1' -"
    delete-branch = "!sh -c 'git delete-local-branch $1; git remotes | cut -f1 | sort | uniq | xargs -n1 -J % git delete-local-reference-to-remote-branch % $1' -"

    currentbranch = rev-parse --abbrev-ref HEAD

    fo = fetch origin
    fu = fetch upstream

    po = push origin
    ; lo = pull origin

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

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

    fuu = "!sh -c 'git fu && git uu' -"
    fuo = "!sh -c 'git fo && git uo' -"
    fuum = "!sh -c 'git co master && git fuu' -"

    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' -"

    fuck-up-history-from = pull --rebase

    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'"

    g = !git fuum

    ; BEGIN KALEIDOSCOPE SECTION
    ; GAZE INTO THE ABYSS

    ; Find all commits in the given ref that aren't also in master
    ; TODO: Make this take a second optional argument
    find-unmerged-commits = "!sh -c 'git log $1 --format='''%H''' --not master --' -"
    find-unmerged-commits-for = "!sh -c 'git log $1 --format='''%H''' --not $2 --' -"

    ; ksdiff is the bare kaleidoscope difftool alias
    ; ksdiffid is the one that expects $KSID to be set
    ksdiff = difftool -y -t Kaleidoscope
    ksdiffid = difftool -y -t KaleidoscopeWithId

    ; ksdiffwith opens a diff of (current revision)->(given revision)
    ksdiffwith = "!sh -c 'git ksdiff HEAD..$1' -"

    ; ksshow will open a single specific commit in kaleidoscope
    ; it includes the commit log info as a separate file
    ksshow = "!sh -c 'export KSID=`uuidgen`; git log -n1 $1 > .git/LOG_MESSAGE_$KSID; ksdiff --partial-changeset --UUID $KSID -- /dev/null .git/LOG_MESSAGE_$KSID; git ksdiffid $1^..$1; ksdiff --mark-changeset-as-closed $KSID' -"

    ; ksreview takes a branch, finds all commits in that branch that aren't
    ; merged into master, and opens them one-by-one with ksshow.  It's good for
    ; reviewing pull requests.
    ksreview = "!sh -c 'git find-unmerged-commits $1 | xargs -n1 git ksshow' -"
    ksreviewfor = "!sh -c 'git find-unmerged-commits-for $1 $2 | xargs -n1 git ksshow' -"

    ; review takes a pull request URL and reviews it
    ; only works if you have the PR-fetching turned on and shit
    review = "!sh -c 'git fetch upstream && git ksreviewfor `echo $1 | sed -Ee \"s_.*pull/([0-9]+)_refs/pull/upstream/\\1_\"` upstream/master' -"
    reviewcombined = "!sh -c 'git fetch upstream && git ksdiff upstream/master `echo $1 | sed -Ee \"s_.*pull/([0-9]+)_refs/pull/upstream/\\1_\"`' -"

    ; END KALEIDOSCOPE SECTION

[push]
    default = current

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

[difftool "KaleidoscopeWithId"]
    cmd = ksdiff --partial-changeset --UUID \"$KSID\" --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"

[difftool "Kaleidoscope"]
    cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"

[difftool]
    prompt = false

[diff]
    tool = Kaleidoscope

[merge]
    tool = splice

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

[mergetool "Kaleidoscope"]
    cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
    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