I’m just starting out with Git (on Windows), so I thought I’d blog about it at the same time.
I downloaded and installed the msysgit version from here: http://code.google.com/p/msysgit/downloads/list.
After installation is complete, create a directory for your source code and initialise a Git repository there:
md c:\dev\git-repo cd c:\dev\git-repo git init
Now, add some code/directories to c:\dev\git-repo.
You may also want to add a .gitignore file to exclude files you don’t want to check in: here is my .NET development .gitignore file.
When you’re done, add them to your Git repository and commit your changes:
git add . <-- this adds all files beneath this level. Hence why you may want a .gitignore file. git commit -m "Initial commit"
Now, so that you can carry your code around on a USB drive, do the following (where g: is my USB drive):
g: md dev cd dev git clone --bare c:\dev\git-repo
You’ll see a message like:
Cloning into bare repository git-repo.git... done.
The “bare” command leaves you with a Git repository without your files and directories. If you want to work on them you need to do the following (on say, your other computer):
c: md dev cd dev git clone G:\dev\git-repo.git
Note: the last git clone was without the “bare” command – so your files will get extracted out of your USB repository and are available to work on.