覚書

~/.gitconfig

[ghq]
  root = ~/src
  • core

    • excludesfile = ~/.gitignore_global
  • filter "lfs"

    • required = true
    • clean = git-lfs clean -- %f
    • smudge = git-lfs smudge -- %f
    • process = git-lfs filter-process
  • user

  • alias

    • delete-merged-branches = !git branch --merged | grep -v \\* | xargs -I % git branch -d %
    • a = add
    • cl = clone
    • cm = commit
    • co = checkout
    • cob = checkout -b
    • d = diff
    • gpush = push origin HEAD
    • p = push
    • st = status
  • fetch

    • prune = true
  • 業務用端末固有の設定はここで読み込む

  • include

    • path = ~/.gitconfig.local
.idea
.DS_Store
.terraform 

業務用端末固有の設定を~/.gitconfig.localに書くようにしている。このファイルはdotfilesとしては管理しない。

[url "git@GHEのURL"]
  insteadOf = https://GHEのURL/
  • includeIf "gitdir:~/src/GHEのURL/"
    • path = ~/.gitconfig.GHEのURL

GHEのリポジトリの場合はユーザ名やメールアドレスを変更したいので、includeIfを使って自動的に切り替えている。

[user]
  name = "GHEで使う名前"
  email = "GHEで使うメールアドレス"