views:

291

answers:

3

I have a need for distributed file synchronization. So first of all, any suggestions? My idea is git since speed is an issue.

My git knowledge is pretty rudimentary though so here's what I did.

I downloaded the portable git (I'm on PC so msysgit). I placed a copy into c:\root\git and a copy into c:\root\git c:\client\git\

I created a directory c:\temp\root\content and created some files in it

c:\root\content>..\git\bin\git.exe init
c:\root\content>..\git\bin\git.exe add *
c:\root\content>..\git\bin\git.exe commit -f
c:\client>..\git\bin\git.exe clone file:///c:\root\content

This creates a content directory but it is empty! The files committed to root are not there.

Also when I do a pull command I get

C:\temp\client\content\content>c:\temp\client\git\bin\git.exe pull
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Your configuration specifies to merge the ref 'master' from the remote, but no such ref was fetched

Clearly I'm missing a concept. What's going on?

A: 

Git can be a good tool for synchronizing source between development and production, for one reason: It makes it easy to "hot fix" in production and check the fix back into the tree. Of course you should always reproduce the bug in a development or test environment and fix it there, but sometimes you can't.

Instead of git add *, use git add .

Use git status before committing to make sure that the appropriate files are staged for commit.

Wayne Conrad
+1  A: 

I just tried to reproduce your steps.

git commit -f didn't do anything with the 1.6.5.1 version I just installed. But it should give you a long error message.

mkdir repo1 repo2
cd repo1
git init
( create files )
git add *
git commit -m "initial commit"
cd ..\repo2
git clone ..\repo1 .

and the files I created in repo1 appear in repo2.

hillu
That worked for you? odd... were you using msysgit?
George Mauer
I used http://msysgit.googlecode.com/files/Git-1.6.5.1-preview20091022.exe .
hillu