Version control with git


Some time ago I decided it was time to change from subversion to git for my version control system. The advantages where obvious. git is distributed and so I can code on my laptop without being connected to my home server. When I do get home I just sync the repositories and everything’s OK.

But, how to do this. I took the easy road and created an user on my home server and made sure I could login with SSH key authentication. After that I did:

ssh git@server
mkdir ~/repos
cd ~/repos
mkdir <new repo>
cd <new repo>
git --bare init
git config gitweb.owner "Ton Kersten"
git config gitweb.description "Description of this repo"

Edit the file ~/repos/<new repo>/description and add a descriptive text for this repository.

On the develop client the next mantra is used:

mkdir <new repo>
cd <new repo>
git init
git remote add server ssh://git@server/home/git/repos/<new repo>
git config gitweb.owner "Ton Kersten"
git config gitweb.description "Description of this repo"

Place a nice description in the file .git/description.

Also create a global git configuration file with the commands

git config --global user.name "Ton Kersten"
git config --global user.email "Weblog_at_TonKersten.com"

Now it’s time to code your fingers to the bone.

After testing, recoding and testing it’s time to commit all changes:

git commit -a

and after getting home:

git push server master
Old 

See also