git commit
The command that records the staging area as a new commit whose parent is the current commit, then moves the current branch to it.
In more detail
git commit -m 'message' takes the message inline; with no message flag Git opens your editor. -a first stages every modification to tracked files, but never adds untracked ones. -F reads the message from a file, or from standard input when the file name is a dash.
Examples
git commit -a -m 'Retry three times before giving up'git commit -F message.txtRelated terms
- commit — A saved snapshot of the whole project in Git, together with its author, committer, time, message and a pointer to the commit before it.
- staging area — Git's list of exactly what the next commit will contain, kept in the file .git/index; also called the index.
- commit message — The text a person writes into a commit to say what it does and why: a one-line subject, a blank line, then an optional body.
- git commit --amend — A form of git commit that replaces the most recent commit with a new one, combining its changes with whatever is staged and optionally a new message.
Taught in
- Security Baselines, Policies & Hardening Standards — Cybersecurity Fundamentals, GRC & Cryptography
- Staging Deliberately: status, add, add --patch — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Conventional Commits — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- A Branch Is A Moving Pointer — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows
- What A Remote Actually Is — Advanced Git Internals & Distributed Workflows
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- The Pull Request, And Branch Naming — Advanced Git Internals & Distributed Workflows
- Resolving A Conflict, Line By Line — Advanced Git Internals & Distributed Workflows
- Amend, And The One Hard Rule — Advanced Git Internals & Distributed Workflows