Thursday, October 2, 2008

Last night I tried running through dmiessler’s Git Primer as a first step towards evaluating git as a replacement for svn. I failed the primer.

—Git Repository—
C:\Repos\Source>echo 123 >foo.txt

C:\Repos\Source>git init
Initialized empty Git repository in C:/Repos/Source/.git/

C:\Repos\Source>git add .

C:\Repos\Source>git commit -a -m “The Initial Import”
Created initial commit cadc60c: The Initial Import
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 foo.txt

C:\Repos\Source>cd ..

C:\Repos>git clone —bare Source Source.git
Initialized empty Git repository in C:/Repos/Source.git/


The source repository with a single file “foo.txt” is set up.

—Dev Environment—
C:\temp\Dev>git clone file://c:/repos/source.git
Initialized empty Git repository in C:/temp/Dev/source/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.

C:\temp\Dev>cd source

C:\temp\Dev\source>echo 345 >bar.txt

C:\temp\Dev\source>git add bar.txt

C:\temp\Dev\source>git commit -a -m “test”
Created commit 1b69f23: test
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 bar.txt

C:\temp\Dev\source>git push
Counting objects: 4, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 265 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To file://c:/repos/source.git
cadc60c..1b69f23 master -> master


The dev environment is now synced up to the git repository (foo.txt is visible). A single file ‘bar.txt’ has been added and committed. This change has been “git push”ed.

—Git Repository—
C:\Repos>cd Source

C:\Repos\Source>git pull .
From .
* branch HEAD -> FETCH_HEAD
Already up-to-date.

C:\Repos\Source>dir
Volume in drive C has no label.
Volume Serial Number is 9872-8C4B

Directory of C:\Repos\Source

10/02/2008 09:48 AM <DIR> .
10/02/2008 09:48 AM <DIR> ..
10/02/2008 09:50 AM <DIR> .git
10/02/2008 09:48 AM 6 foo.txt
1 File(s) 6 bytes
3 Dir(s) 53,560,016,896 bytes free

C:\Repos\Source>


I’ve executed a “git pull” on the git repository but the file ‘bar.txt’ never shows up.

Git-heads, what am I doing wrong?

Update

I solved my own problem

—Git Repository—
C:\Repos\Source>git pull file://c:/temp/Dev/source
remote: Counting objects: 4, done.?[K
remote: Compressing objects: 100% (2/2), done.?[K
remote: Total 3 (delta 0), reused 0 (delta 0)?[K
Unpacking objects: 100% (3/3), done.
From file://c:/temp/Dev/source
* branch HEAD -> FETCH_HEAD
Updating cadc60c..1b69f23
Fast forward
bar.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 bar.txt