Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Making Your First Commit | Introduction to Git
Git Essentials

Making Your First CommitMaking Your First Commit

We have already mentioned what a commit in Git is in the previous chapter. Once again, when you commit, you are creating a snapshot of your project at a particular point in time store it. Let's now discuss how to make a commit.

Making a Commit

In order to commit your changes, you have to run the following command:

The Commit message should be replaced with an appropriate commit message which describes the changes made. In fact, a commit message can either be brief and concise or a detailed description of the changes when needed. For now, we’ll use brief commit messages.

However, before we make out first commit, let's check the status of our working tree and staging area:

Since the only change we made in our project is adding a new text file our commit command will be as follows:

Let’s now run this command in our terminal:

As you can see, the changes that were in the staging area are now committed.

Commit Workflow

Let’s take a look at the process of committing a change to our repository:

Commit workflow

Basically, to commit the addition of a new file we have to take the following steps:

  1. Add the file from the working tree to the staging area;
  2. Commit this change to the repository.

Everything was clear?

Section 1. Chapter 8
course content

Course Content

Git Essentials

Making Your First CommitMaking Your First Commit

We have already mentioned what a commit in Git is in the previous chapter. Once again, when you commit, you are creating a snapshot of your project at a particular point in time store it. Let's now discuss how to make a commit.

Making a Commit

In order to commit your changes, you have to run the following command:

The Commit message should be replaced with an appropriate commit message which describes the changes made. In fact, a commit message can either be brief and concise or a detailed description of the changes when needed. For now, we’ll use brief commit messages.

However, before we make out first commit, let's check the status of our working tree and staging area:

Since the only change we made in our project is adding a new text file our commit command will be as follows:

Let’s now run this command in our terminal:

As you can see, the changes that were in the staging area are now committed.

Commit Workflow

Let’s take a look at the process of committing a change to our repository:

Commit workflow

Basically, to commit the addition of a new file we have to take the following steps:

  1. Add the file from the working tree to the staging area;
  2. Commit this change to the repository.

Everything was clear?

Section 1. Chapter 8
some-alt