> For the complete documentation index, see [llms.txt](https://cumbucadev.gitbook.io/github-essentials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cumbucadev.gitbook.io/github-essentials/dia-3/sua-vez/solucao-exercicio-3.md).

# Solução Exercício 3

#### 1) Antes de fazer qualquer alteração, abra o terminal na pasta \`lista-de-leituras\` e verifique o estado do repositório através do comando:

```bash
git status
```

O resultado será algo como:

```bash
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)
```

#### 2) Em seguida, verifique o histórico de commits do repositório através do comando:

```bash
git log
```

Deve mostrar um erro como&#x20;

```bash
fatal: your current branch 'master' does not have any commits yet
```

#### 3) No VS Code, abra a pasta `lista-de-leituras`

#### 4) No VS Code, crie um novo arquivo chamado `lidos.txt`

#### 5) No VS Code, escreva no arquivo `lidos.txt` o nome de um livro que você já leu, por exemplo:

```
Dom Casmurro
```

#### 6) No VS Code, salve o arquivo (`Ctrl+S` ou `Cmd+S` no macOS)

#### 7) No terminal, verifique novamente o status e veja o que foi alterado:

```bash
git status
```

O resultado será algo como:

```bash
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	lidos.txt

nothing added to commit but untracked files present (use "git add" to track)
```

#### 8) No terminal, veja as diferenças entre o arquivo salvo e o repositório

```bash
git diff
```

O resultado deve ser vazio, uma vez que o arquivo acabou de se tornar rastreado.

Aperte `q` para sair.

#### 9) Adicione o arquivo ao staging:

```bash
git add lidos.txt
```

#### 10) Verifique novamente o status do repositório:

```bash
git status
```

O resultado será algo como:

```bash
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	new file:   lidos.txt
```

#### 11) Veja agora as diferenças que estão no staging (o que será incluído no commit):

```bash
git diff --staged
```

O resultado deve mostrar a linha "Dom Casmurro" em verde adicionada.&#x20;

Aperte a tecla `q` para sair.

#### 12) Faça o commit com a mensagem:

```bash
git commit -m "Adiciona arquivo lidos.txt"
```

O resultado será algo como:

```bash
[master (root-commit) 3132644] Adiciona arquivo lidos.txt
 1 file changed, 1 insertion(+)
 create mode 100644 lidos.txt
```

#### 13) Verifique novamente o histórico do repositório:

```bash
git log
```

Você verá algo como:

```bash
commit 313264487b7ef3db52bba883e1ddf108ee446284 (HEAD -> master)
Author: Seu Nome <seu@email.com>
Date:   Tue Jul 15 12:57:30 2025 -0300

    Adiciona arquivo lidos.txt
```

Aperte a tecla `q` para sair.

#### 14) Verifique novamente o status do repositório:

```bash
git status
```

O status deve indicar que não há alterações pendentes:

```bash
On branch master
nothing to commit, working tree clean
```

***

:books: Parabéns! Você criou seu primeiro commit no projeto `lista-de-leituras` 🎉\
Agora o Git está rastreando o arquivo `lidos.txt`, e seu histórico de commits já registra essa primeira mudança.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cumbucadev.gitbook.io/github-essentials/dia-3/sua-vez/solucao-exercicio-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
