Git – Committing Changes To The Repository

Previous chapter we have created our new clean repository but we did not added any code. In this chapter we will add some code and create some revision or versions of the code.

Getting Status of Repository

As we stated before we have a clean repository we can check this.

1

2

3

4

5

6

$git status

On branch master

Initial commit

nothing tocommit(create/copy files anduse"git add"totrack)

As we see status command provides some brief information about repository. We are on the master branch. We will look branches in the future. We have nothing to commit. Sure we have not added anything for now.

Adding Files to the Revision

Git have some fundamental steps to commit. We will look them through writing our app. Below we can find the natural flow of a commit.

Working Copy

We will create our app with the following code.

1

$echo'print("Hello Poftut")'>main.py

We have created a file main.py with single line code.

Review Changes

We have added some code to our project and want to see status of working copy. Working copy is currently used snapshot of the files.