Quantcast
Channel: Programming – Xinyustudio
Viewing all articles
Browse latest Browse all 284

Git Command explained with snapshots (I)

$
0
0

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


Filed under: Programming

Viewing all articles
Browse latest Browse all 284

Trending Articles