[wiki] Git, a Quick Start Guide

25
Aug 08

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

Random Posts

    5 Responses to “[wiki] Git, a Quick Start Guide”

    1. Juan LupiónNo Gravatar Says:
      August 25th, 2008 at 11:10 pm

      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 Says:
      August 26th, 2008 at 12:37 pm

      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. Ale MuñozNo Gravatar Says:
      August 26th, 2008 at 1:43 pm

      You *have* to take a look at this: Git for Designers

      It’s not for designers, really, but it’s worth reading : )

      Also, I’ve found the Git Internals book at Peepcode is very usefull when learning Git (don’t be afraid of the “Internals” thingie, it is readable by *humans* : )

    4. Jorge CorreaNo Gravatar Says:
      August 26th, 2008 at 10:50 pm

      @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.

    5. Agustín JiménezNo Gravatar Says:
      August 27th, 2008 at 11:54 am

      Great post!!!

      I was just waiting for an article like this to start with Git. Good job. :)

    Leave a Reply