Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
More about Tracking Files | Introduction to Git
Git Essentials
course content

Contenido del Curso

Git Essentials

Git Essentials

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

bookMore about Tracking Files

As we discussed previously, when we work with Git, the files in our project directory can either be tracked or untracked. While tracked files are part of the snapshots (future commits), untracked files are not. Newly created files, for example, are usually untracked until they are added to the staging area.

Speaking of tracked files, they can be in one of the three possible states:

  • modified (certain changes are made to the file, but Git doesn't store them yet);
  • staged (the changes are ready to be committed and will be a part of the snapshot);
  • committed (the changes are stored in a snapshot in the .git directory).

Let’s take a look at an image to make things clear:

Note

If our file is already tracked and we made some changes to it, we will still have to run the git add command to stage these changes.

Let’s now modify our test.txt file via the following command:

The >> operator appends the text enclosed in the double quotes (or single quotes) to an existing file, which in our case is test.txt. The text is added to the end of the file on a new line.

Now, our file has a modified status. We will then use the git add, git status and git commit commands to stage this change, check the status of our working tree and staging area and commit the change, respectively:

As you can see, we have now staged our changes and created a new snapshot of our project via committing the staged changed.

question-icon

Suppose we have a file named preprocessing.py. Your task is to put the actions with the respective commands in the correct order, so that the changes in this file will be committed.

1.
2.

Click or drag`n`drop items and fill in the blanks

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 9
We're sorry to hear that something went wrong. What happened?
some-alt