If you are coming from a very centralized repository system (csv, svn), moving to Git may fell like landing into a foreign country. Git, -- or similar less popular mercurial -- is decentralized repository version controller.
To put it simply, with Git you can still work even when your repository server is inaccessible for some reason or another. One of Git's power is branching which surpasses what svn is capable of doing. You can get a full list of benefits from Git over svn here: https://git.wiki.kernel.org/index.php/GitSvnComparison
On the other hand Git is not easy to learn, so I'll try to post small articles here to share some tips or infos about Git.
But like Peter Parker's uncle would say: " With great power comes great responsibility"
Because you get new super powers you should not try to compare normal habilities with super power habilities. Translated: do no think that because svn and git both uses identical terms such as commit they mean the same thing, they don't ! You have to take it as learning something new.
Work environment
The first thing you need to understand is that your repository is first local before it is remote. This has huge advantages for you to work on different thinks, keep track of progress, toss it aside to work on something else and then go back to what you where working on seamlessly.
Let's see what the different areas are :
Workspace:
This place is what your files on your disk look like now. This is where you will code with your favorite IDE, change, destroy and rebuild. Whatever is in here is not necessarily known to Git.
To make it known to Git, you will need to add the files. once added the files are found in the Staging (or Index) area.
Staging (or Index):
This are files that are known to Git.This are the file that will be taken in the next commit. Committing files will add them to the local repository.
Local repository:
It's the heart of the decentralized system, where repositories are stored on your machine so you can work without the need of a server. From there you can push a local repository changes to a remote location.
Remote location:
I want to stress the term location rather than server, because the idea is that you do not have one single centric server, you can have several locations where you can push your finished feature. One remote location can be a QA machine or server, another can be a staging server, a colleague repo, etc... possibilities are limitless. but also this is where most precaution is needed.
Stash:
last but not least, the stash area is where you can 'hide', set aside, some development in your Workplace the time you work on something else, then get it back when you're done working. If you've been working for some time with svn, then you'll leap in joy just because of this a
I would suggest you look at the following site to understand the different levels of areas that exists localy up to the remote locations. It will serve you as a good cheat sheet and reference until you are comfortable with Git. http://ndpsoftware.com/git-cheatsheet.html#loc=index;
Learning
Some git commands allow you to skip an area, so knowing the commands and what they do is key. Push, add, comit may seem similar but they have different meanings.A good site to learn all the commands needed is this one : http://gitref.org/
More in future articles....
No comments:
Post a Comment