git commit
Record staged changes as a commit
Syntax
git commit [<options>] [--] [<pathspec>...]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-m --message |
git commit -m "fix: bug" |
Common | |
--amend |
git commit --amend |
Common | |
-a --all |
git commit -am "update" |
Common | |
--no-edit |
git commit --amend --no-edit |
Advanced | |
--allow-empty |
git commit --allow-empty -m "trigger CI" |
Advanced |
Examples
git commit -m "feat: "
git commit -am "fix: "
git add,
git commit --amend -m "New "
commit hash,
git add forgotten-file.js git commit --amend --no-edit
,
Common Errors
nothing to commit, working tree clean, git add
Aborting commit due to empty commit messageprovides -m Parameters
Tips
- Conventional Commits : feat/fix/docs/refactor
- --amend force push,