Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git commit

Commit staged changes to version history

Syntax

git commit [options] [<file>...]

Common Options

OptionDescription
-m <msg>Specify commit message
-a, --allAuto-stage and commit tracked files
--amendAmend last commit
--amend --no-editAmend without changing message
--allow-emptyAllow empty commit
--verboseShow diff in commit message
--fixup=<commit>Create fixup commit for rebase
--squash=<commit>Create squash commit for rebase

Examples

git commit -m "Initial commit"

Commit with message

git commit -am "Fix bug"

Stage tracked files and commit

git commit --amend

Amend the last commit

git commit --allow-empty -m "Trigger CI"

Empty commit to trigger CI

Related Tools

More Code & Dev Tools