Stage and commit changes with git add and git commit
domain: git-scm.com/git · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Check what changed with git status, which shows untracked, modified, and staged files.
Stage the files you want to include: git add <file1> <file2>, or stage everything with git add . (dot stages new and modified files below the current directory).
Verify the staging area: git status now lists staged files under 'Changes to be committed'.
Create the commit: git commit -m "describe the change". Use multiple -m flags to create separate paragraphs in the message.
To stage all modified and deleted tracked files and commit in one step, use git commit -a -m "message" (note -a does NOT stage new untracked files).
To change only the most recent commit message or add files to it, stage the additions then run git commit --amend --no-edit to keep the same message, or omit --no-edit to rewrite it.
Known gotchas
Files are only committed if they are staged first; git commit alone commits what is already in the index, not your unsaved working-tree edits.
git commit -a stages modified and deleted tracked files but never newly created untracked files — you must git add those explicitly.
Committing with no message (no -m and no editor input) is rejected; git fails with 'Aborting commit due to empty commit message' unless --allow-empty-message is set.
A malicious-looking empty message or an editor that exits with an error aborts the commit; use -m for scripted non-interactive commits.
git commit --amend rewrites the branch tip — do not amend commits that you have already pushed and shared without understanding the history rewrite.
Official doc: https://git-scm.com/docs/git-commit
Give your agent this knowledge — and 16,900+ more routes
One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?