Git Commit-Related Commands Guide

Commit-Related Commands

git commit - Commit Changes to Repository

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 message
git commit -am "Fix bugs" - Automatically stage all tracked files and commit
git commit --amend - Modify the previous commit (opens editor)
git commit --amend -m "Updated commit message" - Change the previous commit message
git commit --amend --no-edit - Add changes to the previous commit (without changing the message)