Records changes from the staging area to the repository.
Option | Description |
---|---|
-m <message> | Specify commit message |
-a, --all | Automatically stage all tracked files before committing |
--amend | Modify the previous commit |
--no-edit | Use with amend to reuse the previous commit message |
Examples:
git commit -m "Add new feature"
- Commit with a messagegit commit -am "Fix bugs"
- Automatically stage all tracked files and commitgit commit --amend
- Modify the previous commit (opens editor)git commit --amend -m "Updated commit message"
- Change the previous commit messagegit commit --amend --no-edit
- Add changes to the previous commit (without changing the message)