Initialize the Repository

We will create our first git project in this tutorial.

You could create a folder named Git in C disk. It is a definitely not required to create this C:\Git folder, but it’s my personal preferences that I put all my repository in that folder.

Then you create a new folder named GitLearn in the C:\Git folder and this is going to be our project folder.

We could use `git init` to initialize the empty git repository here,
```bash
git init 

Then we get the successful initialization confirmation in the bash.

git init
Initialized empty Git repository in C:/Git/GitLearn/.git/

git status

Before we begin to add files in the repository, we could use git status to get the current status of the repository.

$ git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

Indeed, the repository is still empty and there is no single commit yet. Ok, then we could add some files to this folder. Create a test1.txt text file and put some sentences like This is my first Git repository. in the file and save it. If you check git status again, you will get

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	test1.txt

nothing added to commit but untracked files present (use "git add" to track)

The new file appears in the status information inside the untracked file list. The untracked files will not be kept track if we don’t add and commit them. We need first to add them to the staging area by using git add command,

git add test1.txt

Now, type git status again to retrieve the latest repository status.

$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

	new file:   test1.txt

The added file is in the staging area now and waiting for commit. You should use git commit command to commit the new staged file test1.txt to the repository.

$ git commit -m "the first commit. add test1.txt to the repository"
[master (root-commit) 15322c9] the first commit. add test1.txt to the repository
 1 file changed, 1 insertion(+)
 create mode 100644 test1.txt

If you check the status now, you will get a clean working tree information.

$ git status
On branch master
nothing to commit, working tree clean

If you want to get the logging information of the commit history, you could type git log to retrieve the commit log.

$ git log
commit 15322c93a528af85dbba478a77b93cb6477698cb
Author: Your Name <yourname@email.com>
Date:   Wed Jul 25 00:14:49 2018 +0200

    the first commit. add test1.txt to the repository