LoginSignup
0
2

More than 3 years have passed since last update.

Dotfiles をエレガントにマネージメントする

Last updated at Posted at 2020-07-22

jitakutaiki_stayhome.png

なんか横文字かぶれみたいな標題ですが(笑)
知っている方には今更な話でしょうけども、 コピペにもシンボリックリンクにも他ツールにも依存もせずに .vimrc .bashrc 等を github/gist 等でバージョン管理する術の紹介です

I use:
git init --bare \$HOME/.myconf
alias config='/usr/bin/git --git-dir=\$HOME/.myconf/ --work-tree=\$HOME'
config config status.showUntrackedFiles no
where my ~/.myconf directory is a git bare repository. Then any file within the home folder can be versioned with normal commands like:
config status
config add .vimrc
config commit -m "Add vimrc"
config add .config/redshift.conf
config commit -m "Add redshift config"
config push
And so one…
No extra tooling, no symlinks, files are tracked on a version control system , you can use different branches for different computers, you can replicate you configuration easily on new installation.

Dotfiles を github 等のリモートリポジトリでバージョン管理していくのはよい発想ではありますが、ローカルで肝心の読み込みをさせるために $HOME に配置する必要があります。
通常だと 作業ディレクトリ$HOME ではない任意のどこか)にあるソースをいちいち $HOME に持っていくとか、同期したりしなければならないことになろうかと思います。
そのためにあっちからこっちにコピペしたりリンクを張ったりするわけですが、それがバカバカしくなってくるのですよ。

それならばと、スクリプトを書けば自動化出来るということもあるかもしれません。
けれどもよくよく考えてみれば、そんなつまらないコピペやリンクの生成スクリプトなんか書きたくないというのがエンジニア心というもの。
かといって追加のなんらかのツールとかに依存するのもイヤ
どうにかして管理負荷を最小化しながらも都合は良くできないのか?

そこで bare を活用した前掲のソリューションというわけです
こちら でも紹介されてますね。やはり元ネタは冒頭のリンク先のようです

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2