Skip to content

Instantly share code, notes, and snippets.

@alem0lars
Last active August 29, 2015 14:08
Show Gist options
  • Save alem0lars/d04f497cbb8c1b46be02 to your computer and use it in GitHub Desktop.
Save alem0lars/d04f497cbb8c1b46be02 to your computer and use it in GitHub Desktop.
How to add a configuration (using VCSH and MR)
_config_name="foobar" # Replace "foobar" with the config name
_config_repo="[email protected]:alem0lars/configs-${_config_name}.git" # Replace with the right remote repo
# 1. Create the remote repository named: config-${_config_name}
# MANUAL
# 2. Add to MR
# 2.1 Add to available.d
echo "[\$HOME/.config/vcsh/repo.d/${_config_name}.git]" > ~/.config/mr/available.d/${_config_name}.vcsh
echo "checkout = vcsh clone ${_config_repo} ${_config_name}" >> ~/.config/mr/available.d/${_config_name}.vcsh
vcsh mr add -f ~/.config/mr/available.d/${_config_name}.vcsh
# 2.2 Add to config.d
_cur_dir=`pwd`; cd ~/.config/mr/config.d; ln -s ../available.d/${_config_name}.vcsh .; cd ${_cur_dir}
vcsh mr add -f .config/mr/config.d/${_config_name}.vcsh
# 3. Pull the remote repository
mr update
# 4. Add the desired files
# MANUAL (e.g. to add `~/my/config` execute `vcsh ${_config_name} add ~/my/config`)
# 5. Generate the gitignore file for the configuration repository
vcsh write-gitignore ${_config_name}
vcsh ${_config_name} add -f .gitignore.d/${_config_name}
vcsh write-gitignore ${_config_name} # Update the gitignore to allow tracking of gitignore itself
# 6. Modify the gitignore file for the MR repository
vcsh write-gitignore mr
# 7. Commit (and push) changes
mr commit -m "Added ${_config_name}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment