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