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
course content

Conteúdo do Curso

Git Essentials

Git Essentials

1. Introduction to Git
2. More Advanced Interaction
3. Undoing Changes
4. Working with Branches in Git

book
Making 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:

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.

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 8
We're sorry to hear that something went wrong. What happened?
some-alt