aboutsummaryrefslogtreecommitdiffhomepage
path: root/.config/git/config
blob: be4723aa8117372481fceb21b97127be2f1ad370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[core]
    editor = nvim
    commentchar = ";"

[advice]
    detachedhead = false

[color]
    ui = true

[merge]
    tool = vimdiff
    ff = false

[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

[diff]
    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]
    helper = osxkeychain

[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
    fixup = commit --fixup
    amend = commit --amend --no-edit
    clone1 = clone --depth=1
    co = checkout
    cob = checkout -b
    com = "!__fn() { \
        if git rev-parse --verify --quiet main > /dev/null 2>&1; then \
            git checkout main \"$@\"; \
        elif git rev-parse --verify --quiet origin/main > /dev/null 2>&1; then \
            git checkout origin/main \"$@\"; \
        elif git rev-parse --verify --quiet master > /dev/null 2>&1; then \
            git checkout master \"$@\"; \
        elif git rev-parse --verify --quiet origin/master > /dev/null 2>&1; then \
            git checkout origin/master \"$@\"; \
        else \
            echo 'error: no branch found' >&2; \
        fi; \
    }; __fn"
    cod = "!__fn() { \
        if git rev-parse --verify --quiet develop > /dev/null 2>&1; then \
            git checkout develop \"$@\"; \
        elif git rev-parse --verify --quiet origin/develop > /dev/null 2>&1; then \
            git checkout 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
    tmp = commit -a -m "TMP"
    tmps = stash save "TMP"
    ctmp = commit -m "TMP"
    sst = stash save "TMP"
    ss = stash save
    ssl = stash list
    ssa = stash apply
    ssd = stash drop
    ssp = stash pop
    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"
    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 = "!git pull upstream $(git current-branch) --ff"
    pullo = "!git pull origin $(git current-branch) --ff"
    pusho = "!git push origin $(git current-branch)"
    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"