Commit
You might say
Save the code changes I have now—I don't want things to get messy and lose this working version.
Save one meaningful set of changes in the project historyA commit records selected changes with an author, time, and message. Before undoing work, distinguish uncommitted edits from commits that have already been pushed. Shared history is usually reversed with a new revert commit instead of rewriting old records.
Know first
You can say this to an AI Agent
Inspect git status and the diff first. Commit only the homepage navigation changes and exclude .env. Write a message that says what was completed. After committing, give me the commit hash and confirm that nothing has been pushed yet.
Variants
git add
git add index.html
Specify the changes to be recorded in the next commit
git commit
git commit -m "Description"
After completing an independently explainable change
git log
git log --oneline
View commit history or locate a commit before reverting
git status
git status
Not sure which files were changed, ask it first
Typical use cases
Feature step
$ git add index.html
$ git commit -m "Repair button is misplaced on mobile phone"
[main e7b2d48] Fix button misplacement on mobile phone
1 file changed, 6 insertions(+), 3 deletions(-)
Bug fix
Copy update
$ git log --oneline
e7b2d48 Fix button alignment on mobile
a3f9c21 Finish the home-page navigation
b4c5d67 Home page basic version
0f1e2d3 Initialize project
The first 7 bits are a short hash that can be used to identify the commit
Refactor checkpoint
Recommended tool
Web fine-tuning tool · Selector Pro
Select page elements for precise AI edits
Click a button, text, or card, note the change, then copy its exact location to AI.
Open Selector Pro website↗Further reading
Quick check
git status shows changes in index.html and .env, but this commit should contain only the homepage navigation. What is safer?
ANS Original Methods