How to use Git Command Line on Windows
You can firstly download the git installer for windows below:
https://code.google.com/p/msysgit/downloads/list?can=3
Creating a local repository:
We will firstly create a base for our repositroy:
mkdir C:\repository
We must then open up the Git bash console and CD to our directory, although bare in mind back slashes become foward slashes under Bash or rather the file system.
cd C:/repository
and initialize Git in the directory:
git init
and then designate an upstream server:
git remote add https://monitorflux@bitbucket.org/monitorflux/monitorflux.git
We can then add files to our local repostory e.g. create a file named test.txt within C:\repository and add the file:
git add test.txt
or we could add all files within our local repository – using a wildcard e.g.:
git add *
We can use “git commit” to commit changes made to a local repositroy i.e. on your own computer
git commit -am 'initial commit'
or if the Git repository is hosted remotely e.g. GitHub, you would use the “git push” command e.g.:
git push https://yourusername@bitbucket.org/projectname/project.git master
Close a Repsotiroy:
To clone a repository we will firstly make a new directory:
mkdir C:/cloned_repository cd C:/cloned_repository
and then issue the following command to clone:
git clone https://yourusername@yourhost.org/yourproject/projectname.git
Now we can modify files for committing by issuing the git add or git delete commands e.g.
git delete Home.aspx
or
git add NewFile.aspx
Suppose we had modified an existing file called Home.aspx, since this file has already been indexed within Git and our repository we can simply issue:
git push https://yourusername@bitbucket.org/projectname/project.git master
or
git commit -am 'initial commit'
Although if we added a file called Test.aspx we would need Git to add / index it, so it is aware of the new file e.g.
git add Test.aspx
or we can use wildcards (in this case add everything!):
git add *
and finally we can retrieve changes by using:
git pull
These are really the core commands to Git, there is a lot more to Git than meets the eye, for further reading I would reccomend looking here:
http://help.github.com/git-cheat-sheets/