[wiki] Git, a Quick Start Guide

I’m writing this entry as a personal wiki page, just to note some tips and paste some code I’ll find around while I’m learning a little bit about Git. It will be growing and modifying day by day at same rhythm as my knowledge.

But, what the hell is Git?

Git is a version control Swiss army knife. A reliable versatile multipurpose revision control tool whose extraordinary flexibility makes it tricky to learn, let alone master.

The above quote is from one of the best reference sites I’ve seen about Git: Git Magic.

And, how to use it?

At first you should be able to play with Git, so if you’re running OSX, try this simple installer: Git OSX Installer. Now you should be able to run git from your Terminal in OSX. Yeah! Let’s try!
The next sequence of commands will be used now and again, so don’t be lazy and memorize them ;). It’ll start Git repo and add all the files on you project folder. Last command line is for your first commit!
$ git init
$ git add .
$ git commit -m "My first backup"

Ok, now it’s time to create, add, modify, remove files from your great personal project. How to do it? It’s simple.
$ git add newfiles_or_newfolders
$ git rm oldfiles_or_oldfolders
$ git mv oldfile newfile

The first one from above commads will add new files or folders to your git local copy. Second one will remove them. And, at least, mv will rename the files.

If something fails just type:
$ git reset --hard
$ git commit -a -m "Another backup"

It’ll go back to where you were and save a new state.

Each time you have a fucking-great-power-version you can commit the changes to show it to your friends. So, just type:
$ git commit -a -m "A new fucking-great-power-version"

For now it’s enough if your are, like me, a newbie at Git. With that simple lines of code you should be able to play around. Just create an account at github where you can host some open-source projects for free and look for me overthere.

Ok, if you have used SVN before, you can say: what’s new with Git? Nothing at all. Next time I’ll wrote some lines about the power of Git, but I have to learn it before :)

Feel free to comment and show me your tricks & tips about git. Sure they’ll be helpful for me and, please, remember I’m just a designer who wrote some lines of code sometimes, explain it for a dummy :D

5 thoughts on “[wiki] Git, a Quick Start Guide

  1. Juan LupiónNo Gravatar

    Subversion users should be aware that similarities between git and svn valid command-line options may be misleading: for examples ‘git revert’ is quite different from ‘svn revert’. To make things worse, there *are* some straight equivalences — ‘git st’ does just what ‘svn st’ does. With great power comes great responsibility…

  2. KekoNo Gravatar

    I made a script with the three initial instructions in my scripts folder, and an alias “sgit” in my .bash_profile (to avoid the .sh, yes, I’m laaaazy).

  3. Jorge CorreaNo Gravatar Post author

    @Juan Lupión Right now I’m not afraid. Once I run a very *real* project I’ll be carefull, sure!

    @Keko work less, make more :)

    @Ale Muñoz two great references! thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *