views:

139

answers:

4

I am a Git newbee with UNIX SCCS and Microsoft Visual SourceSafe experience. I’m just learning Git and it seems to have a huge and painful learning curve. I’ve already seen Git blow away all the data files I hadn’t committed, which concerns me. (How a utility can delete data files without warning is beyond me).

Linus Torvalds, in his video on Git, claims that Git is distributed, touts the benefits of distribution, but other than everyone having a copy (clone) of the source, doesn’t really explain how distribution works.

How does Git help distribution? How does Git help recover lost files? How does Git distribution work? Can I find where files have been distributed? Is there a Git distribution tutorial?

Thanks in advance!

+1  A: 

Git and Mercurial both follow very similar patterns on dealing with the distributed nature of the SCM. I can't speak to good Git tutorials, but there are some great works out there on Mercurial.

Understanding Mercurial - This has good information on the exact question you're asking... what does it mean for it to be distributed?

Mercurial Book - For more in-depth investigations.

Ben Von Handorf
+3  A: 

Read this : http://www.newartisans.com/2008/04/git-from-the-bottom-up.html


As for your other questions :

How does Git work ?

This is not a question specific enough to be answered. But generally, Git works by creating objects and putting them in a tree. The objects correspond to changes you have made to your content. Trees are objects themselves. What Git tracks is the changes made to the content in the repository.

How does distribution work?

Because all repositories can be servers, different repositories can compare their trees and objects, and determine what the changes are between such repository's current state and another. Thus, they are able to push to/pull from other repositories.

How does it help?

If you don't see how it can help you, stick with MVSS.


I think there might be a vocabulary problem. Distribution is not shipping. Git's distribution means every repository is a server. It doesn't mean it will keep track of where it has been cloned (although your own repository can keep a list of remote repositories from which to pull from / push to).

Read the PDF I made a link to. Then create a github repository by following their indications. Fork someone else's repository, anyone, just to see how it works.

subtenante
How does Git work? How does distribution work? How does it help?
PalaDolphin
Fairies. It's all about the fairies.
subtenante
A: 

You probably changed to a different branch. Run git branch to see what branches you have, then git co <branchname>.

Personally I really hate git. Big learning curve and a wierd command line interface. But it is the coolaid of choice right now. So enjoy! Oh yeah, don't learn VSS unless you have too, you will learn REALLY REALLY Bad habits. VSS is everything source control shouldn't be.

Byron Whitlock
except it wouldn't have allowed him to change branch with uncommitted changes without stashing
Tesserex
You say you hate it. But we all know you're secretly in love with it ;-)
ldigas
A: 

Git, and other DVCS, basically "bring" the entire repository to the user. When I have a git working copy, I also have the entire reposotory locally on my hard disk. No one else has access to it but I can share it via various tools amd methods provided by the git system.

Other systems, such as SVN (which Linus mentions in the video), has the entire repository on a single server. Everyone pushes and pulls from that server.

Again, looking at git, my commits are isolated to my computer. When I'm ready for others to have them, I then "publish" my additions in some fashion -- perhaps on a central server like SVN but that is only one option. I could email you my changes.

Prevention of Data Loss

One perspective of the prevention of loss of data, is that if I have a copy of the entire repository and you have a copy of then entire repository, if either of us loose our hard drive, we can re-clone the repository. Of course, this assumes we are exchanging our progress and working towards a common goal.

Compare this to SVN (or other central repos), if you lose the servers hard drive, you have to restore the repo from the last back up if you have a backup. This would mean someone needs to manage the server and ensure backups are running etc. DVCS, in a way, do this inherently.

Of course, there is also the "loss of data" from such mistakes such as accidental file deletes, but that applies to all VCS.

Frank V
I think it's important to emphasize here that the word distributed in DVCS means precisely that multiple people have clones of the repository; Linus *did* explain how distribution works in that video.
Jefromi