Donnerstag, 24. März 2011

Putting users configuration under Git version control

Hi girls and guys,

today i want to show you something which a friend of mine
Reiner Herrmann pointed out for me.

There are two main reasons why you want to put your configuration under version control. You can document what you are changing and when you are changing files like ~/.bashrc or ~/.vimrc for example. At least those are the files which changes quite often on my machines. And the second reason is to simply providing an easy way to restore your configuration when things became messed up.

First make sure you have installed git. This should be in the main repository of your distribution. For Debian simply install it using apt-get install git.

I am now going to show you how you can put your ~/.bashrc under version control
using git.

If you are not familiar with git simply go to the website. You find all documentation
you will ever need on this website.

Let's assume for now i am under /home/matthias. Create a Directory ~/.local_gitrc

mkdir ~/.local_gitrc

and create the Git Repository by navigating in this particular directory you've just created. Here you can initialize your git Repository by typing:

git init

That's all. Your Git Repository have been initialized. Next you copy the original ~./bashrc to this
directory

cp ~/.bashrc bashrc

and add this to your git directory blob

git add bashrc

Make your first commit.

git commit -m " bashrc: initial commit"

Now as the final step link the Script in Your Git Repository to it's original location.

ln -sf /home/mattias/.local_gitrc/bashrc /home/matthias/.bashrc

There have been a lot of suggestions around the internet that you should be able to do this with the
/etc directory too. The result is a a script called etckeeper.



Thats it.

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.