It depends on what you are trying to achieve.Does anyone use any sort of version control for maintaining scripts or configuration files such as /etc/rc.conf or /etc/fstab etc.?
git status
will just list a bunch of stuff in "untracked" files.*
and force add the files you care about.For those of you using version control for config files, how do you track only the files that you care about? Three options I'm aware of:
- Nothing special - add the files you care about.
git status
will just list a bunch of stuff in "untracked" files.- Ignore
*
and force add the files you care about.- Make a repo with only the files you care about outside of /etc, and copy them into place as needed.
--git-dir
(or GIT_DIR
environment) is very handy. You can basically have config files on your system but then use things like git diff
, without needing to add a toplevel .git directory to the root/. The data can be out of tree and separated from the VCS metadata.If I used RCS, where should I create an RCS repository?It looks like RCS is the simplest, so will try to incorporate it into emacs...
[strand.130] # cd /etc
[strand.131] # mkdir RCS
[strand.132] # ci hosts rc.conf
RCS/hosts,v <-- hosts
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> initial version
>> .
initial revision: 1.1
done
RCS/rc.conf,v <-- rc.conf
enter description, terminated with single '.' or end of file:
NOTE: This is NOT the log message!
>> initial version
>> .
initial revision: 1.1
done
[strand.133] # ls -lad hosts rc.conf
ls: hosts: No such file or directory
ls: rc.conf: No such file or directory
[strand.134] # co -l hosts rc.conf
RCS/hosts,v --> hosts
revision 1.1 (locked)
done
RCS/rc.conf,v --> rc.conf
revision 1.1 (locked)
done
[strand.135] # ls -lad hosts rc.conf
-rw-r--r-- 1 root wheel 4994 Oct 4 08:57 hosts
-rw-r--r-- 1 root wheel 715 Oct 4 08:57 rc.conf
[strand.136] # ls -al RCS
total 18
drwxr-xr-x 2 root wheel 4 Oct 4 08:57 .
drwxr-xr-x 34 root wheel 126 Oct 4 08:57 ..
-r--r--r-- 1 root wheel 5197 Oct 4 08:57 hosts,v
-r--r--r-- 1 root wheel 918 Oct 4 08:57 rc.conf,v
git init . && git add * && git commit -m “initial commit”
and you’re off.Just to add to this, its actually my main reason I use CVS. If you are familiar with RCS, it is basically the format used internally for CVS repositories. This means that unlike some random Git, Subversion database blob, the CVS/RCS data is human readable. This gives me a little bit more reassurance if anything goes horribly wrong.RCS does not use a central repository. It pre-dates that concept.
The default behaviour it to store the revision history for each file in another file in the same directory with ",v" appended to the file name.
If you really need Version Control,
What you really want version control for is to get up the courage to rip apart code that's working already so that you can improve it, without being afraid that you're going to totally screw up and lose a version that sort of works. If you've ever worked without version control as a safety net, you know the kind of things you end up with. Any development directory ends up littered with manual backups like:
some_program.c.old
some_program.c.older
some_program.c.not_so_old
some_program.c.ok
some_program.c.sorta_ok
some_program.c.ng
some_program.c.ngier
some_program.c.almost_not_ng
some_program.c.getting_there
Just want to tell that as an non-coder just purely amateur, the given example is so me, it is just hilarious to read itsome_program.c.old
some_program.c.older
some_program.c.not_so_old
some_program.c.ok
some_program.c.sorta_ok
some_program.c.ng
some_program.c.ngier
some_program.c.almost_not_ng
some_program.c.getting_there
Everybody does this at first. Right up until they find the benefits of using a version control system.Just want to tell that as an non-coder just purely amateur, the given example is so me, it is just hilarious to read it
I have a bunch of small scripts, don't have a separate repository for each, I just bundle all of them together in a single repo.well on the other hand I suppose less than 40 lines shell scripts don't really need it.
I found a different solution: I run regular incremental file-level backup to a backup server, and for specific directories containing configuration files I run them every 10 minutes.
For the rare cases when one really wants to investigate what has been changed when, this is good enough. And it also gives protection against accidential deletion, like, you write stuff for an hour or so, and then somehow delete it unintentionally.