Manage Your Configs with vcsh
Now that your file's being tracked by the git repository inside vcsh, let's commit it by running the following git-like command:
bill@test:~$ git commit -m 'Initial Commit' master (root-commit) bc84953 Initial Commit Committer: Bill Childers email@example.com 1 file changed, 2 insertions(+) create mode 100644 .vimrc
Now for the really cool part. Just like standard git, you can push your files to a remote repository. This lets you make them available to other machines with one command. Let's do that now. First, you'll add the remote server. (I assume you already have a server set up and have the proper accounts configured. You'll also need a bare git repo on that server.) For example:
bill@test:~$ git remote add origin git@gitserver:vim.git
Next, push your files to that remote server:
bill@test:~$ git push -u origin master Counting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 272 bytes, done. Total 3 (delta 0), reused 0 (delta 0) To git@gitserver:vim.git * new branch master -> master Branch master set up to track remote branch master from origin. bill@test:~$ exit
exit line at the end. This exits the
"vcsh fake git repo". Now
your .vimrc file is checked in and copied to a remote server! If there are
other programs for which you'd like to check in configurations, like mutt, you
simply can create a new repo by running
vcsh init mutt, and then run through
the process all over again, but this time, check your files into the mutt
Move Your Configuration to Another Machine
To sync your configuration to another machine, you just need to install vcsh, git and mr, and then run a similar process as the steps above, except you'll do a git pull from your server, rather than a push. This is because you don't have the .vimrc file you want locally, and you want to get it from your remote git repository.
The commands to do this are:
bill@test2:~$ sudo apt-get install vcsh git mr bill@test2:~$ vcsh enter vim bill@test2:~$ git remote add origin git@gitserver:vim.git bill@test2:~$ git pull -u origin master From gitserver:vim * branch master -> FETCH_HEAD bill@test2:~$ exit
Now you've got your checked-in .vimrc file on your second host! This process works, but it's a little clunky, and it can become unwieldy when you start spawning multiple repositories. Luckily, there's a tool for this, and it's called mr.
Wrapping It All Up with mr
If you plan on using multiple repositories with vcsh (and you should—I'm
tracking 13 repositories at the moment), getting a configuration set up
for mr is essential. What mr brings to the table is a way to manage all the
repositories you're tracking with vcsh. It allows you to enable and
disable repositories simply by adjusting one symlink per repository, and it
also gives you the ability to update all your repos simply by running one
Perhaps the best way to get started using mr is to clone the repo that the vcsh author provides. This is done with the following command:
bill@test2:~$ vcsh clone ↪git://github.com/RichiH/vcsh_mr_template.git mr Initialized empty Git repository in ↪/home/bill/.config/vcsh/repo.d/mr.git/ remote: Counting objects: 19, done. remote: Compressing objects: 100% (14/14), done. remote: Total 19 (delta 1), reused 15 (delta 0) Unpacking objects: 100% (19/19), done. From git://github.com/RichiH/vcsh_mr_template * new branch master -> origin/master
Bill Childers is the Virtual Editor for Linux Journal. No one really knows what that means.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- SuperTuxKart 0.9.2 Released
- Google's SwiftShader Released
- Parsing an RSS News Feed with a Bash Script
- LiveCode Ltd.'s LiveCode