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
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
Further reading
