Conteúdo do Curso
Git Essentials
Git Essentials
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:
- Add the file from the working tree to the staging area;
- Commit this change to the repository.
Obrigado pelo seu feedback!