dotfiles管理

创建文件夹,用于管理自己的dotfiles

1
2
3
mkdir dotfiles
cd dotfiles
git init

把系统里的dotfiles软连接到这个文件夹

1
2
3
cd ~/
mv .zshrc /Users/xxx/develop/dotfiles/zshrc
ln -s /Users/xxx/develop/dotfiles/zshrc .zshrc

建立git本地仓,并push到github远程仓库同步

1
2
3
4
5
cd /Users/xxx/develop/dotfiles/
git add .
git commit -m '创建dotfils'
git remote add origin [email protected]:username/dotfiles.git
git push -u origin master

恢复dotfiles

1
2
3
git clone [email protected]:username/dotfiles.git dotfiles
rm -rf .vimrc .zshrc //首先删除自身机器上原有的dotfiles
ln -s dotfiles/zshrc .zshrc

自动化

Ref:https://luolei.org/dotfiles-tutorial/