git commit
SafeSave a snapshot
Records everything in the staging area as a new permanent snapshot with a message.
Live example
- Commit 05a229a: First commit, labels: main, HEAD is here
Working directory
No unsaved changes
2 files on disk
Staging area
the next snapshot
Local repository
HEAD · 05a229a
$ git commit -m "Add hello"
Syntax
git commit -m "<message>"git commit -am "<message>"git commit --amend
Useful options
- -m <msg>
- The commit message
- -a
- Stage modified tracked files automatically
- --amend
- Replace the last commit