> 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-4/sua-vez/exercicio-4.md).

# Exercício 4

## Desfazendo alterações locais não commitadas

Neste exercício, você vai praticar como desfazer alterações feitas no seu projeto **lista-de-leituras**, focando em como usar os comandos `git restore` e `git restore --staged` para gerenciar alterações não desejadas antes de um commit.

### ✅ Tarefa

Faça alterações em um arquivo do seu projeto lista-de-leituras, depois pratique desfazer essas alterações tanto antes quanto depois de adicioná-las à *staging area*, usando os comandos `git restore` e `git restore --staged`. Observe como cada comando afeta o estado do seu repositório.

***

#### 💡Dica&#x20;

1. Utilize `git status` frequentemente para monitorar o estado atual do seu repositório.
2. Use `git diff` para revisar as alterações que ainda não foram adicionadas ao staging.
3. Use `git diff --staged` para conferir as alterações que já estão prontas para o próximo commit.
4. Lembre-se que `git restore` descarta alterações no diretório de trabalho, enquanto `git restore --staged` remove arquivos do staging, mas mantém as alterações locais.


---

# 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-4/sua-vez/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.
