Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to track changes of my Linux distrib with git?

I am experimenting some linux configuration and I want to track my changes? Of course I don't want to to put my whole OS under version control?

Is there a way (with git, mercurial or any VCS) to track the change without storing the whole OS?

This is what I imagine:

  1. I do a kind of git init -> all hashes of all files are stored, but not the content of the files
  2. I make some changes to my file system -> git detect that the hash of this file has changed
  3. I commit -> the content of the file is stored (or even better the original file and the diff are stored! I know, that is impossible... )

Possible? Impossible? Work-arounds?

EDIT: What I care about is just to minimize the size of the repository and to have a repository containing only my changes. Having all files in my repository is not relevant for me. For example if i push to github I just want it to contain only the files that has changed.

like image 593
tibo Avatar asked May 26 '12 03:05

tibo


2 Answers

Take a look at etckeeper, it will probably do the job.

like image 74
cirne100 Avatar answered Sep 21 '22 19:09

cirne100


What you want is git update-index --info-only or ... --index-info, from the man page: " --info-only is used to register files without placing them in the object database. This is useful for status-only repositories.". --index-info is its industrial-scale cousin.

Do that with the files you want to track, write-tree to write the index structure into the object db, commit-tree that, and update-ref to update a branch.

To get the object name use git hash-objectfilename.

like image 41
jthill Avatar answered Sep 22 '22 19:09

jthill