summaryrefslogtreecommitdiffstats
path: root/.setup/confgit.sh
blob: 96a13bd7fa6d7e83c5b12e7f9d4c04c77031add5 (plain) (blame)
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
#!/usr/bin/env zsh

rm ~/.gitconfig # Purge existing gitconf

# Dotfiles config
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config protocol.version 2
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config pull.ff only
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config push.default simple
git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config status.showUntrackedFiles no

# Main Git Config
#git config --global checkout.thresholdForParallelism  # Unknown good value
git config --global checkout.workers 0 # Auto-detect threads from CPU
git config --global core.commitGraph true
git config --global credential.https://source.developers.google.com.helper "gcloud.sh"
git config --global fetch.parallel 4
git config --global fetch.writeCommitGraphs true
git config --global hub.protocol https
git config --global init.defaultBranch main
git config --global pack.threads 0 # Auto-detect threads from CPU
git config --global pack.writeReverseIndex true
git config --global protocol.version 2
git config --global pull.ff only
git config --global pull.twohead ort # Use new faster merge algorithm
git config --global push.default simple
git config --global push.followTags true
git config --global status.submodulesummary 1
git config --global user.email tydavis@gmail.com
git config --global user.name "Tyler Davis"

# if [ "$(command -v delta)" ]; then
#   git config --global core.pager delta
#   git config --global delta.line-numbers true
#   git config --global delta.side-by-side false
#   git config --global interactive.diffFilter "delta --color-only"
# fi

case `uname` in
  Darwin)
    if [ "$(command -v nvim)" ]; then
      git config --global core.editor nvim
      git config --global diff.tool nvim
      git config --global merge.tool nvim
    else
      git config --global core.editor vim
      git config --global diff.tool vim
      git config --global merge.tool vim
    fi

    #if [[ -z "${TMUX}" ]]; then #TMUX variable is not set, so we're in something else like vscode
    #  git config --global core.editor "code --wait"
    #  git config --global merge.tool vscode
    #  git config --global diff.tool vscode
    #else
    #  git config --global core.editor nvim
    #  git config --global diff.tool nvim
    #  git config --global merge.tool nvim
    #fi
    git config --global core.excludesfile "/Users/tydavis/.gitignore_global"
    git config --global credential.helper osxkeychain
    git config --global difftool.nvim.cmd "nvim -d \$LOCAL \$REMOTE \$MERGED -c 'wincmd w' -c 'wincmd J'"
    git config --global difftool.vscode.cmd "code --wait --diff \$LOCAL \$REMOTE"
    git config --global http.cookiefile /Users/tydavis/.gitcookies
    git config --global mergetool.vscode.cmd "code --wait \$MERGED"
  ;;
  Linux)
    # commands for Linux go here
    if [[ -z "${TMUX}" ]]; then #TMUX variable is not set, so we're in something else like vscode
      git config --global core.editor "code --wait"
      git config --global diff.tool vscode
      git config --global merge.tool vscode
    else
      git config --global core.editor nvim
      git config --global diff.tool nvim
      git config --global merge.tool nvim
    fi
    git config --global core.excludesfile "/home/tydavis/.gitignore_global"
    git config --global credential.helper "store --file=/home/tydavis/.config/gitcreds"
    git config --global difftool.nvim.cmd "nvim -d \$LOCAL \$REMOTE \$MERGED -c 'wincmd w' -c 'wincmd J'"
    git config --global difftool.vscode.cmd "code --wait --diff \$LOCAL \$REMOTE"
    # Adding signoff for Kernel work
    git config --global format.signoff true
    git config --global http.cookiefile /home/tydavis/.gitcookies
    git config --global mergetool.cmd "code --wait \$MERGED"
    # Email configuration for `git send-email` command
    git config --global sendemail.annotate yes # Review and edit each patch
    git config --global sendemail.confirm auto
    git config --global sendemail.smtpserver /usr/bin/msmtp
  ;;
  FreeBSD)
    # commands for FreeBSD go here
  ;;
esac