0

Could I put a certain file in some VCS like git/subversion/etc only "when" I am modifying it. So first I put the unmodified version & then the modified version. The desire is to put the file in VCS only when I want, rather than doing initial full directory commits.. Is this possible ?

I want to version some of the configuration files that I modify on my ubuntu server, but I wish not to do an initial full directory commit, rather i'm looking if it is possible to a add file to VCS just before I am modifying the file.. how could i achieve this ?

I'm aware of etckeeper but that is only for /etc & it does a initial full directory commit ? why do I do that.. i would rather only want to keep the files i modify & manually manage rather than autocommits at each install.

1
  • reason for downvote ? Did I presented a wrong idea ? Mar 15, 2014 at 10:17

2 Answers 2

1

If I understand you correctly, what you want to do is possible with bazaar (and probably other version control systems). Run:

bzr init /path/to/dir
cd /path/to/dir
bzr ignore "*"
bzr ci -m "Initial commit."

This will put the directory into version control, but none of the actual files will be versionized. Later, when you want to add a specific file to the repo, run bzr add file

This is what I've done with my home directory.

0

You would need a trigger right before a file was changed. So right before it is opened for writing. If this is possible at all, then inotify would be the way to go. But looking at its man page, I only see IN_OPEN, which seems too generic for the purpose, so I don't really see a way to make this work.

Why you are so strongly against the full directory commit? The content will be stored zipped, and your configurations shouldn't be too large. You can also exclude part of the configuration files by marking them ignored. Or you can exclude everything by default, and only include specific files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .