Git, simple source control system

Applications, Linux, Tutorial

If you project is bigger than 20 lines or it has over 1 user, you need source controlling system. If you are doing something very complex or you have many users it’s good to choose services like Google code or Beanstalk. (or something else)

But if you only need a source control system for your self, it’s not so clever to take remote source reporisity, because you can have your own source control system on your local machine!

Setting up svn server is much more difficult than setting up local git repository. I recommend to use git for every small local projects, because it is extremely easy to set up and it doesn’t require server to run.

So, install git (apt-get install git git-core) and then go to your projects directory and type:
Git init
Git add .

First command initializes git repository on .git folder and second command adds every file to new repository. In future when you add more files to project, just use “git add “.

Then do the first commit to get it working.

Git commit -a

Commit command opens default editor on your system. If you want to change it to another editor, add next line to your .bashrc file. (and reload bash to get it working :) )

export EDITOR=vim

Then just continue coding your project. When you want to commit more, just use previous command to do it. After you have done couple of commits you may want to see what you have done. Use “git log” to view latest commits.

When you type just “git” you will get list of sample commands that you will need later. More documentations can be found from gits website.

I recommend to try graphical git application: giggle. It makes it easier to understand branches.

Happy coding :)

No Comments

Leave a Reply

Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>