Rudi Engelbrecht's Blog

Just another site

Archive for January 2011

Git Recipes – Initialising local and remote

leave a comment »

Understanding git and using it as a distributed version control system is easy once you manage to ‘unlearn’ the the concept of a server repository used by SVN and CVS.

I usually start a new project by working on my local machine and then after a while I would like to continue the project on another machine.

Starting a Git Project

mkdir project
cd project
git init

Create and edit files as needed.

git add .
git commit -m “initial commit”

The local files are now commited to the local master branch.

Once you are ready to share the files / project on another machine, create a git project on your remote machine, or use github / / to provide a remote repository.

The next few steps will link and push the local master branch to the remote master branch hosted at

git remote add origin
git push origin master

The local master branch is now pushed to the remote master branch.

You can continue working on the local repository, create local branches, merge them into your local master branch, and once you feel the remote master branch needs to be updated, then you can use the line below.

git push origin master

Hope this helps 😉


Written by Rudi Engelbrecht

January 15, 2011 at 10:53 am

Posted in Uncategorized