# Edit a file

Editing files directly within your repository on Protocol.Land is a common task that allows for quick updates and iterations.

Follow these steps to edit files within repositories on Procotol.Land:

1. Navigate to the main page of the repository.
2. Click on the file you wish to edit from the file list.
3. You will be redirected to the file page.
4. Click on the edit icon at the top right corner of the file tab.\
   ![](/files/r00bI5PLhhZN7u5ImYyB)
5. You will be redirected to the code editor for the file.
6. Make changes to the code in the provided code editor.
7. The “Preview” tab in the editor shows the updated markdown version for files with the \`.md\` extension. For other file types, it shows a diff view of the code highlighting the changes made.\
   ![](/files/ZvVzRX0g7GlXXLYFQ74y)
8. Once you've made the necessary edits, you have the option to “Cancel Changes” or “Commit Changes” to the active branch.\
   ![](/files/MlGRir99qO7NxPG72Q5P)
9. Click “Commit Changes”.
10. You will be prompted with a modal to add a commit message.\
    ![](/files/MCn6bNIR7VyH7hON1gzG)
11. Type in the desired commit message that summarizes the changes.
12. Preview the estimated cost of committing your changes by hovering over the information icon.
13. Click “Commit changes”.
14. You will be redirected to the file page where you can view the updated file content.


---

# Agent Instructions: 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://docs.protocol.land/working-with-files/edit-a-file.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.
