LoginSignup
50
50

More than 5 years have passed since last update.

homesick を使って dotfiles を管理する!

Last updated at Posted at 2014-01-17

install homesick

$ gem install homesick

GitHub に dotfiles リポジトリ作成

  • GitHub で dotfiles リポジトリを作成してください。

  • ローカルに dotfiles を作成します。

$ mkdir ~/dotfiles 
$ cd ~/dotfiles
$ git init
Initialized empty Git repository in /Users/user_name/dotfiles/.git/

$ mkdir home 
$ cd home
$ cp ~/.vimrc . 
$ cp ~/.zshrc .
  • 作った dotfiles リポジトリに push
$ git add .
$ git commit -m 'Initial commit'
$ git push -u origin master

作った dotfiles を homesick で設置する

  • 作ったリポジトリを homesick clone で GitHub から clone
$ homesick clone user_name/dotfiles
git clone  https://github.com/user_name/dotfiles.git to /Users/user_name/.homesick/repos/dotfiles
  • シンボリックリンクを貼る
$ cd ~ 
$ homesick symlink dotfiles 
  • こんな感じになれば OK !!
$ ls -al
*** .agignore -> /home/webuser/.homesick/repos/dotfiles/home/.agignore
*** .bashrc -> /home/webuser/.homesick/repos/dotfiles/home/.bashrc
*** .gitconfig -> /home/webuser/.homesick/repos/dotfiles/home/.gitconfig
*** .vimrc -> /home/webuser/.homesick/repos/dotfiles/home/.vimrc
*
*
*

dotfiles を 更新した時!!

$ homesick pull dotfiles
$ homesick symlink dotfiles

おしゃんてぃ。。

もし下記のエラーメッセージを言われたら。。。

Cannot pull with rebase: You have unstaged changes.
Please commit or stash them.

こんな感じで対処してください。

cd ~/.homesick/repos/dotfiles
git add .
git stash save
homesick pull dotfiles
homesick symlink dotfiles
git stash pop
50
50
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
50
50