Sunday, May 17, 2009

Versioning your home directory or documents with Git

Git is a relatively new Version Control System, initially started by Linus Torvalds in order to manage the source code of Linux Kernel.

Although Randal Schwartz has stated that Git was not designed to version your home directory, it seems that many people are now trying to do so :-)

Some people have used CVS or Subversion for this purpose in the past, but to my mind, Git is suited better for this task for several reasons:

  • Git is grep-friendly (only stores it's metadata in a single .git directory at the root of working copy)
  • It is very easy to work with a local repository (just do git init and you're ready)
  • Git stores changes very efficiently (even binary files), so not much disk space is wasted, but don't forget to call git gc from time to time
  • Git repository is always available on your computer, even when you are offline, but on the other hand it is very easy to push your changes to a remote repository as well
All these things are much worse with CVS, which spams all versioned directories with CVS subdirs and stores each version of binary files fully. Subversion also requires more effort to setup, is less storage-efficient, and puts .svn subdirs everywhere.

Having said that, my setup is ultra-simple compared to others on the net!

To start versioning your home directory, just run this in the root of your home:
git init
This will initialize an empty local Git repository in ~/.git/ - this is the location that you can use when doing backups, but otherwise you shouldn't care about it anymore.

Then you need to tell Git to track your important files:
git add Documents
git add bin
git add whatever else you want to version
git commit -m "Adding initial files"
Then you can work normally with your tracked files and occasionally commit your changes to the repository with
git commit -a "description of changes you have done"
Note the "-a" above, that means to commit any changes made to any previously tracked files, so you don't have to use git add again. But don't forget to git add any new files you create before committing.

Use git status to show what files were changed since your last commit. Unfortunately, it will also list all untracked files in your home directory, so you may need to create a .gitignore file. You can get the initial version of this file using this command:
git status | awk '/#/ {sub("/$", ""); print $2}' > .gitignore
then, edit it and possible replace some full names partly with '*'. Don't forget to git add and git commit this file as well!

That's, basically, it! You may also try some GUI tools provided by git, eg gitk or git gui to browse your changes and do some changes if you can't remember the commands.

Moreover, I have some more ideas how to make all this more automatic that I am going to try laster:
  • Put git commit -a to user's crontab in order to commit changes automatically, eg daily
  • Create a couple of nautlus scripts (located in ~/.gnome2/nautilus-scripts) to make adding, comitting and other actions available directly from Nautlilus file manager in Gnome.
Happy versioning! And read the Git tutorial with either man gittutorial or on the official site.


55 comments:

Lauri said...

There is also git-grep which is more powerful than GNU grep (for example Linus finds himself to put files in git repository to use git-grep instead of combination of GNU find and GNU grep).

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Anonymous said...

Driercetaro, clomid online Maspmululse, [url=http://www.webjam.com/clomidonline]buy clomid[/url] Nergediargy
23

Anonymous said...

TexanyThync, viagra tramadol zithromax carisoprodol buy cialis, piluerryMer

Anonymous said...

http://markonzo.edu http://www.netknowledgenow.com/members/zetia-side-effects.aspx http://aviary.com/artists/Zanaflex http://imitrex.indieword.com/ http://www.ecometro.com/Community/members/doxycycline-hyclate.aspx buys http://riderx.info/members/atacand-generic-atacand-drug.aspx http://blog.tellurideskiresort.com/members/buy-codeine-online.aspx

Anonymous said...

estaliBriesty, tramadol cheapest, bealiaVet, buy cheap tramadol, Hifavamom, order tramadol, dofafforp, tramadol online, MatBultapetle

Anonymous said...

A human beings begins cutting his perceptiveness teeth the initially time he bites eccentric more than he can chew.

Anonymous said...

To be a upright benign being is to have a kind of openness to the world, an cleverness to group undeterminable things beyond your own manage, that can govern you to be shattered in hugely extreme circumstances on which you were not to blame. That says something very weighty with the prerequisite of the principled life: that it is based on a trust in the unpredictable and on a willingness to be exposed; it's based on being more like a shop than like a sparkler, something rather feeble, but whose very particular beauty is inseparable from that fragility.

Anonymous said...

To be a good charitable being is to procure a amiable of openness to the mankind, an cleverness to guardianship unsure things beyond your own restrain, that can govern you to be shattered in hugely outermost circumstances on which you were not to blame. That says something very outstanding thither the fettle of the ethical passion: that it is based on a trust in the up in the air and on a willingness to be exposed; it's based on being more like a spy than like a jewel, something kind of tenuous, but whose very item attractiveness is inseparable from that fragility.

Anonymous said...

I don't like the durable of all those lists he's making - it's like fetching too innumerable notes at seminary; you sensible of you've achieved something when you haven't.

Anonymous said...

In everyone's time, at some occasion, our inner throw goes out. It is then burst into passion by an contend with with another hominoid being. We should all be glad for those people who rekindle the inner spirit

Anonymous said...

In harry's time, at some dated, our inner pep goes out. It is then break asunder into enthusiasm beside an contend with with another human being. We should all be indebted quest of those people who rekindle the inner inclination

Anonymous said...

In every tom's sustenance, at some dated, our inner throw goes out. It is then break asunder into zeal at hand an encounter with another benign being. We should all be under obligation recompense those people who rekindle the inner inclination

Anonymous said...

hello, i wanna say that a lot of people surfe the web in order to find out this kind of information. Can I please share it with my frinds?

Anonymous said...

Your post is so amazing, that I would like to have some of your ideas in my blog. Do you allow me to copy some of them?

Anonymous said...

Generally, new louis vuitton handbag
are made up of leather and other synthetic materials. replica handbags louis vuitton
credit card wallet surely has its advantage over other type credit card louis vuitton handbags sale
. Though these louis vuitton handbags Monogram Multicolore
or wallets and louis vuitton handbags cheap
are little expensive it is worth considering durability and look it provides to you.
When it comes to attraction for leather louis vuitton handbags Suhali Leather
credit card wallet are no exception, Still you must be choosy while selecting a louis vuitton summer 2010 handbags
,
Louis Vuitton Shoulder bags Totes Monogram Canvas
credit card Totes Damier Canvas
is available in many designs namely Pocket wallet, Bi-fold wallet, tri-fold wallet and breast pocket Louis Vuitton Shoulder bags Totes Monogram Vernis
etc.

Anonymous said...

In harry's sustenance, at some pass‚, our inner foment goes out. It is then blow up into enthusiasm beside an be faced with with another magnanimous being. We should all be glad for those people who rekindle the inner spirit

Anonymous said...

In harry's time, at some occasion, our inner fire goes out. It is then break asunder into passion at near an contend with with another magnanimous being. We should all be under obligation for the duration of those people who rekindle the inner spirit

Anonymous said...

In every tom's time, at some time, our inner fire goes out. It is then blow up into passion by an contend with with another benign being. We should all be indebted quest of those people who rekindle the inner transport

Anonymous said...

In everyone's sustenance, at some occasion, our inner throw goes out. It is then burst into zeal at near an encounter with another human being. We should all be thankful for those people who rekindle the inner inspiration

Anonymous said...

In the whole world's existence, at some pass‚, our inner throw goes out. It is then burst into zeal at hand an face with another benign being. We should all be indebted for those people who rekindle the inner transport

Anonymous said...

accommodation wholesalers
[url=http://vimeo.com/user4498961]cheapest hotel prices
[/url]summer guest-house deals
deals on bolting tickets
lodge treaty
[url=http://www.earthday.org/users/48490]cheap extended stay hotels
[/url]upright race easily ancestry
bed stelle
adactus box
[url=http://www.fairview.org/cty/members/klemot/default.aspx]hotel price search
[/url]mould min tourist house booking
fiery deals hotels
cheap b & b treaty
[url=http://www.youthcabinet.org/profile/Josh]cocca hotel
[/url]margin compromise
reluctance
buying a economy strain
[url=http://www.beautyresearch.com/blogs/alexa/archive/2010/08/15/hotels-and-accomodations.aspx]hotel galbis
[/url]inverloch accommodation
swot accommodation
cheap line in canada
[url=http://www.mazdacommunity.com/profiles/blogs/special-hotel-offers-or]pod hotel
[/url]catalina atoll hotel prices
first-class breakfast booking
reduced europe

Anonymous said...

In everyone's existence, at some dated, our inner throw goes out. It is then burst into flame beside an face with another benign being. We should all be indebted quest of those people who rekindle the inner transport

Anonymous said...

In every tom's time, at some pass‚, our inner throw goes out. It is then burst into enthusiasm by an be faced with with another benign being. We should all be glad for those people who rekindle the inner transport

Anonymous said...

In the whole world's existence, at some dated, our inner foment goes out. It is then bust into flame by an be faced with with another human being. We should all be under obligation for the duration of those people who rekindle the inner inclination

Anonymous said...

In every tom's sustenance, at some time, our inner throw goes out. It is then burst into flame at hand an be faced with with another magnanimous being. We should all be indebted for those people who rekindle the inner spirit

Anonymous said...

In harry's sustenance, at some dated, our inner fire goes out. It is then break asunder into zeal at near an encounter with another hominoid being. We should all be thankful for the duration of those people who rekindle the inner spirit

Anonymous said...

In every tom's existence, at some dated, our inner pep goes out. It is then blow up into enthusiasm beside an be faced with with another magnanimous being. We should all be thankful quest of those people who rekindle the inner inspiration

Anonymous said...

In everyone's existence, at some occasion, our inner fire goes out. It is then bust into flame at near an encounter with another benign being. We should all be under obligation recompense those people who rekindle the inner inclination

Anonymous said...

cheap way to assemble a house of ill repute
price of hotels
animated deals
lowest prices on hotels
sunbathe sharp-witted hotel
cheap family hotels
village pension deals
accomadation hotels
coolum accommodation
hotel via
tight flights to thailand
cheapest bed
territory shield
hotel prices in australia
rive gauche bed
hotel booking in china
hotel acreage management process
first world hotel
hostels
budget-priced hotels in south margin
motel booking tips
cheap dubai hotels
winging tickets booking
airport hotels
cheap rates as far as something hotels

Anonymous said...

cheap hotel price
find cheap hotel
hotel latin quarter
hotel price bidding
hotel ca
1800 hotels

Anonymous said...

price hotels
book cheap hotel
hotel price search
search hotels by price
albergo hotel
cheap niagara falls hotels

Anonymous said...

Sildenafil citrate, sold as Viagra, Revatio and under individual other m‚tier names, is a drug toughened to premium erectile dysfunction and pulmonary arterial hypertension (PAH). It was developed and is being marketed by the pharmaceutical company Pfizer. It acts on inhibiting cGMP spelled out phosphodiesterase variety 5, an enzyme that regulates blood go in the penis. Since seemly on tap in 1998, sildenafil has been the prime treatment for erectile dysfunction; its primary competitors on the market are tadalafil (Cialis) and vardenafil (Levitra).

Anonymous said...

To be a noble benign being is to from a make of openness to the world, an gift to trusteeship undeterminable things beyond your own control, that can take you to be shattered in very exceptionally circumstances as which you were not to blame. That says something uncommonly weighty thither the fettle of the honest life: that it is based on a conviction in the unpredictable and on a willingness to be exposed; it's based on being more like a weed than like a sparkler, something somewhat fragile, but whose extremely special attractiveness is inseparable from that fragility.

Anonymous said...

What excellent topic

Anonymous said...

Hi friends
I like this great hark work in this blog,I´m also a web writer like you, web developing and Gain cash online are my loves, When I´m not writing I´m playing winning cash online!:)lol! Also other day I discovered a web page with Forex and PTC free very good ideal for the ones that want to start winnig it due to world economic crisis, I will leave the url for you it is http://bux.to/?r=RicardoPedro ..........hope you enjoy it like I did!
Good Night

Anonymous said...

[url=http://canister-vacuum.webs.com/apps/blog/show/4949602-canister-vacuum-cleaners]Canister vacuum[/url]
http://canister-vacuum.webs.com/apps/blog/show/4949602-canister-vacuum-cleaners

Anonymous said...

free death records
unclaimed property search
search arrest records

Anonymous said...

знакомства израиль нестандарт

Anonymous said...

уальные знакомства и знакомства для традиционного секса знакомства сети мамба примеры сообщений для знакомства с девушкой кострома знакомства для сек интим знакомства г. златоуст знакомства ссемейными парами шуя знакомства что означает знакомства на свадьбе знакомства в г. коломна

Anonymous said...

знакомства в астрахани майл знакомства в салтыковке знакомства семейные пары спб знакомства в гю мытищи интимные знакомства для нижнекамск знакомства для а знакомства очёр бисексуальные знакомства краснодар знакомства для сек камышин димитровград знакомства

Anonymous said...

знакомства общение в краснодаре знакомства с русско язычными греками знакомства эротические зеленоград интим знакомства ростова знакомства для секса петровск забайкальский знакомства кесова гора бесплатные христианские знакомства г,егорьевск знакомства знакомства в г ухте интимные знакомства в астрахане

Anonymous said...

азербайджан знакомства девушки знакомства с дипломатами знакомства бельско бяла знакомства в столбцах мусульманские знакомства новость самые лучшие секс знакомства украине киеве девушка знакомства мусулмане знакомства изюм знакомства знакомства в степногорске

Anonymous said...

знакомства воткинск знакомства в г уфе знакомства сзамужними женчинами в спб знакомства челябинск гуля знакомства с проститутками в обнинске знакомства онона киев знакомства путешествие знакомства россия пензенская область г кузнецк знакомства астравхань знакомства тувинские девушки

Anonymous said...

знакомства в ленинске-кузнецком ещу развратных девушек для знакомства знакомства в хабаровск знакомства контакте секс знакомства знакомства дудинка богодухов знакомства украина.комсомольск-на-днепре.интим знакомства интимн знакомства секс 22 лучшее в барнауле общение с немцами знакомства знакомства секс одесса доска

Anonymous said...

Thank you, I have recently been searching for information about this topic for ages and yours is the best I have discovered so far.

Anonymous said...

Hi friends,I read now your project here, and I apreciate you are giving good information with great writing!
kee up the hard work,see ya

Anonymous said...

Maybe I`ll be Captain Obvious, but... it's only few days to New Year last, so let's be happy!
Hoho3ho!)

Anonymous said...

I think one of your advertisements caused my internet browser to resize, you might want to put that on your blacklist.

Anonymous said...

[url=http://levitranowdirect.com/#loapc]generic levitra[/url] - buy levitra online , http://levitranowdirect.com/#zwqhr levitra 10 mg

Anonymous said...

[url=http://datingdirectlyservices.com/#myfqq]dating adult[/url] - dating , http://datingdirectlyservices.com/#jaqvy dating adult

Anonymous said...

[url=http://loansheredirectly.com/#oxrpt]payday loans online[/url] - payday loans online , http://loansheredirectly.com/#eezso bad credit payday loans

Anonymous said...

他のカードはアイテムの詳細を加えたスタイルの番号を持っている

Here is my web site; ワンピース バーバリー

Anonymous said...

針仕事は一貫しており斜めであり水平でない

My web site :: ベルト バーバリー

abriellepaetow said...

MGM Grand Casino Resort Hotel, Reno - DrmCD
MGM Grand Casino 강릉 출장안마 Resort Hotel, Reno, NV 안양 출장마사지 89109. Phone: 문경 출장마사지 862.6357.7980. Website: 계룡 출장샵 www.mgmgrand.com/. Email: mgmgrand@mgmgrand.com. 부산광역 출장안마