Name

commit

Synopsis

git commit [-- file ...]

Commit the changes that have already been staged in the index, updating HEAD.

If -a is given, all changed files in the work tree—not only staged changes—will be committed. (-a is the common behavior in systems like Subversion.)

If files are specified, exactly those files are committed, regardless of the state of the index.

You cannot commit a file for the first time, even with -a, unless it has first been added with git add.

Options

-a (all files, not just added ones)
--amend
-m commit-message, --message=commit-message
-F commit-message-file
-q, --quiet
-s, --signoff

Examples

To commit changes only to files in the mylib directory:

$ git commit -- mylib
Created commit 90716b6: my new commit
 1 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 test-file

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.