This blog post details managing the dotfiles using vcsh and mr.
The two aspects involved in managing dotfiles are:
1. Adding/Tracking the required dotfiles onto vcsh’s local git repository, pushing it to remote repository managed using myrepos.
2. The bootstrap procedure on a new PC.
Phase1: Initializing environment for dotfiles management
vcsh init mr vcsh enter mr cd .config/ mkdir -p mr/{available.d,config.d} cd mr/available.d/ vim mr.vcsh [$HOME/.config/vcsh/repo.d/mr.git] checkout = vcsh clone https://Username@bitbucket.org/Username/suman-mr-config.git mr cd ../config.d/ ln -s ../available.d/mr.vcsh env | grep GIT vim ~/.mrconfig [DEFAULT] git_gc = git gc "$@" jobs = 5 include = cat /usr/share/mr/vcsh include = cat ~/.config/mr/config.d/* git add ~/.mrconfig git commit -s -a -m 'Sumans .mrconfig' git remote add origin https://Username@bitbucket.org/Username/suman-mr-config.git git push -u origin master
Phase2: Adding dotfiles to repository
Lets take an example of managing .vim and .vimrc files.
ln -s ~/.vim/vimrc ~/.vimrc vcsh init vim vcsh enter vim cd .config/mr/available.d/ vim config-vim.vcsh [$HOME/.config/vcsh/repo.d/config-vim.git] checkout = vcsh clone https://Username@bitbucket.org/Username/config-vim.git config-vim cd ../config.d/ ln -s ../available.d/config-vim.vcsh git add .vim git commit -s -m 'Sumans .vim directory for config-vim bitbucket mr myrepos mgmt' git remote add origin https://Username@bitbucket.org/Username/config-vim.git git push -force -u origin master exit
The last command i.e., exit – gets out of vcsh shell.
Verify if the repos are up to date using below command.
$ mr up
Phase3: Bootstrapping on a new machine:
On a newly installed Ubuntu PC, install vcsh, git and mr.
sudo apt-get install vcsh mr git git-core git-email vim
Now, pull the required repository using below commands
vcsh enter vim git remote add origin https://Username@bitbucket.org/Username/config-vim.git git pull -u origin master exit
Your customized vim configuration is up and running on second host up!!!!
An even simpler command would be clone repository using vcsh and do mr up on the new host to pull all your repos automatically.
vcsh clone https://Username@bitbucket.org/Username/config-vim.git config-vim mr up