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”
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.
The folder after“git init” is executed (hidden files)
Now add a new file, e.g. SomeText.txt to this folder
Then type the below command: “git status”
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 |
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
This terminates the link of “SomeText.txt” in the folder with Git now.
All right, let’s finally add it to Git!
Previous article on Git | Next article on Git
Filed under: Programming
