git revert
A Git command that creates a new commit undoing an earlier one, leaving the history intact.
In more detail
The mistake and its fix both stay in history, and no commit is rewritten, so revert is the safe way to undo a commit others already have. --no-edit accepts the generated message.
Example
git revert --no-edit HEADRelated terms
- Git — A free, open-source distributed version control system that records the history of a project as a chain of snapshots.
- backout plan — The written steps for undoing a change if it goes wrong, prepared before the change is made.
- git reset — The command that moves the current branch to another commit, and depending on the mode also resets the staging area and working tree.
- 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.
Taught in
- A Hotfix At 3 A.M.: Who Wins At 3:05? — Certified GitOps Associate (CGOA) Exam Prep
- Sixteen Pods, Room For Twelve: The System, Feedback And Continuous — Certified GitOps Associate (CGOA) Exam Prep
- Two Ways Back From 2.5: Rollback The GitOps Way — Certified GitOps Associate (CGOA) Exam Prep
- Terminology Sprint: One Incident, Nine Terms — Certified GitOps Associate (CGOA) Exam Prep
- Someone Cleaned Up The History: Versioned And Immutable — Certified GitOps Associate (CGOA) Exam Prep
- Thursday, With A Way Back: Promotion, Deploy And Release — Certified GitOps Associate (CGOA) Exam Prep
- Friday, Four Fifty: Progressive Delivery — Certified GitOps Associate (CGOA) Exam Prep
- Patterns Sprint: Eight Needs, One Pattern Each — Certified GitOps Associate (CGOA) Exam Prep
- The Evening Before: Final Review — Certified GitOps Associate (CGOA) Exam Prep
- Shift-Left Security Principles & Automated Pipeline Gates — Cloud Security & DevSecOps Engineering
- Continuous IaC Drift Detection & State Protection — Cloud Security & DevSecOps Engineering
- Cloud Security Posture Management & Remediation — Cloud Security & DevSecOps Engineering
- 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
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows