O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required