RSS

Git Command explained with snapshots (I)

10 Dec

The very beginning step is probably creating/selecting a folder (e.g. C:\_Test) where to keep your source code. Now this folder is just a common folder, and it is not a Git repository yet. To let Git know this, use the command: “git init

image 

image
The folder before “git init”

After running the command, a hidden directory “.git” will be created, as shown below. Git use this to distinguish a common folder with a repository or working directory.

    image image
The folder after“git init” is executed (hidden files)


Now add a new file, e.g. SomeText.txt to this folder

image

 

 

 

 

 


Then type the below command: “git status

image

As is seen that although a file is added to the folder, but Git is ignorant of this yet!


To inform Git that it should keep an eye (or track) this file, use below commands
git add SomeText.txt
git status

image


Now Git gets informed that this file is added!  Or more specifically, the file is Staged (but not actually added to the repository yet!)



Let ‘s try again to remove this file from Git repository: the highlighted words are typed-in commands

image

This terminates the link of “SomeText.txt” in the folder with Git now.


All right, let’s finally add it to Git!

image

image


Previous article on Git   |  Next article on Git

 
1 Comment

Posted by on December 10, 2011 in Programming

 

One response to “Git Command explained with snapshots (I)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: