# Committing changes

<table data-full-width="true"><thead><tr><th>Description</th><th>Commands</th></tr></thead><tbody><tr><td><p>Stage files for commit</p><ul><li>Use "git add” to add files to every commit, it’s not a blanket save</li><li>Use a wildcard <code>*</code> to add all files of the same extension to the staging area</li><li>Use <code>.</code> to stage all changes ready for commit</li><li>If you are in the root directory of your repository, <code>git add .</code> and <code>git add -A</code> will have the same effect, staging all changes in the repository. However, if you are in a subdirectory, <code>git add .</code> will only stage changes in that directory and its subdirectories, while <code>git add -A</code> will still stage changes from the entire repository.</li></ul></td><td><p><code>git add &#x3C;FILE_NAME></code></p><p><code>git add *.html</code></p><p><code>git add .</code></p><p><code>git add -A</code></p></td></tr><tr><td>Show all changes currently staged for commit</td><td><code>git status</code></td></tr><tr><td>Unstage a file after adding it</td><td><code>git reset HEAD &#x3C;FILE_NAME></code></td></tr><tr><td><p>Commit changes</p><ul><li>Comments should be in present tense (e.g. "Add comments and update styling")</li><li><code>-a</code> stages all changes so you can stage changes and commit with a comment all in one line instead of the separate command <code>git add .</code> but only works on files that are already being tracked, so not that useful for newly added files...</li><li><code>--amend</code> allows you to edit the commit e.g. change the comment</li></ul></td><td><code>git commit -m "&#x3C;COMMENT>"git commit -am "&#x3C;COMMENT>"</code></td></tr><tr><td><p>Change details of the last commit</p><ul><li>opens an editor by default or add <code>-m</code> to</li></ul><p><br></p></td><td><p><code>git commit --amend</code></p><p><code>git commit --amend -m "&#x3C;NEW_COMMIT_MESSAGE>"</code></p></td></tr><tr><td><p>Change a specific commit and all the following commits</p><ul><li><code>^</code> use this to get the parent of the commit you want to change</li><li><code>--root</code> references the very first commit in a repo</li></ul></td><td><p><code>git rebase --interactive &#x3C;PARENT_OF_COMMIT></code></p><p><code>git rebase -i &#x3C;COMMIT_TO_EDIT>^</code></p><p><code>git rebase -i --root</code></p></td></tr></tbody></table>


---

# 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.eridian.xyz/general-dev/git-notes/committing-changes.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.
