> 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-4.md).

# Solução Exercício 4

#### 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
```

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.

#### 3) No VS Code, edite o arquivo `lidos.txt` adicionando uma nova linha representando um outro livro já lido, por exemplo:

```
O Ateneu
```

O conteúdo do arquivo deve estar semelhante à:

```
Dom Casmurro
O Ateneu
```

#### 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
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   lidos.txt

no changes added to commit (use "git add" and/or "git commit -a")
```

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

```bash
git diff
```

O resultado deve mostrar a linha "O Ateneu" em verde adicionada, logo abaixo de "Dom Casmurro"&#x20;

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)
	modified:   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 "O Ateneu" em verde adicionada, logo abaixo de "Dom Casmurro"&#x20;

Aperte a tecla `q` para sair.

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

```bash
git commit -m "Adiciona título à lista de livros lidos"
```

O resultado será algo como:

```bash
[master d644703] Adiciona título à lista de livros lidos
 1 file changed, 1 insertion(+)
```

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

```bash
git log
```

Você verá algo como:

```bash
commit d644703fa3831d41259488a4f36c70a7a3cb7bc0 (HEAD -> master)
Author: Seu Nome <seu@email.com>
Date:   Tue Jul 15 15:07:26 2025 -0300

    Adiciona título à lista de livros lidos

commit 313264487b7ef3db52bba883e1ddf108ee446284
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
```

***

📚 Parabéns! Agora você já tem dois commits no seu projeto `lista-de-leituras`, cada um registrando um novo livro que entrou para a sua história como pessoa leitora.


---

# 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-4.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.
