How to Commit Changes in Git (git commit)

git commit records the currently staged changes as a new snapshot in the repository's history, along with a message describing them.

Published September 27, 2026

git commit records the currently staged changes as a new snapshot in the repository's history, along with a message describing them.

Key points

  • Only staged changes (added via git add) are included — unstaged changes are left out
  • A good commit message explains why a change was made, not just what changed
  • git commit -a stages and commits all tracked, modified files in one step, skipping the separate git add

Example

git commit -m "Fix pagination bug on search results"
More Git articles