リポジトリの状況
~/workspace |-- foo | `-- foo-repo `-- bar |-- bar-repo1 `-- bar-repo2
~/workspce
に切り替えたい単位にディレクトリを作成しそれぞれリポジトリを置いてます。
ホーム配下
~/ .gitconfig -> dotfiles/.gitconfig .gitconfig.local .gitconfig.foo .gitconfig.bar dotfiles `-- gitconfig
dotfiles(github管理)のしたに .gitconfig
を作成しどこでも使うものはそこに記述します。
それをシンボリックリンクで、HOME配下に配置します。
PCごとに違う設定にしたいものは .gitconfig.local
に。
.gitconfig.local
に includeIf
を使って案件ごとの設定を記述します。
.gitconfig
[include] path = .gitconfig.local
.gitconfig.local
[includeIf "gitdir:~/workspace/foo/"] path = .gitconfig.foo [includeIf "gitdir:~/workspace/bar/"] path = .gitconfig.bar
.gitconfig.foo, .gitconfig.bar
[user] name=example email=example@example.com