Back to lessons

Hosting Operations

Risk: caution

Revert the Suspect Release Commit

The suspect release has already been shared, and you need a rollback commit that preserves branch history.

Command

cd /lab/git-recovery-rollback && git restore -- app/config.yml && git revert --no-edit release-2026-06-25-1030

Before you run this

Risk: caution. Do not use revert blindly when the bad release included database migrations or external side effects that need a separate rollback plan.

Expected output

Git restores the dirty file, creates a revert commit, and the recent log shows the new Revert commit above the suspect release.

System impact

The dirty config line is discarded, then a new local revert commit is created inside the disposable demo repository.

When to use it

Use when a bad commit is already published or shared and rollback should be represented as a forward-moving commit.

When not to use it

Do not use revert blindly when the bad release included database migrations or external side effects that need a separate rollback plan.

Recovery / rollback

Reset the disposable fixture branch back one commit or recreate the fixture.

Watch this command run

Example output from a temporary Linux lab

This example uses disposable sample files and sanitized output so you can inspect the shape of the result before touching a real system.

demo@lab:~$

$ cd /work/git-recovery-rollback && git status --short && git log --oneline --decorate -3

 M app/config.yml
?? releases/current
de583c6 (HEAD -> main, tag: release-2026-06-25-1030) Release 2026-06-25 10:30
c15c7c6 (tag: release-2026-06-25-1000) Release 2026-06-25 10:00
ddb9d51 (tag: release-2026-06-24-1700) Release 2026-06-24 17:00

$ cd /work/git-recovery-rollback && git restore -- app/config.yml && git revert --no-edit release-2026-06-25-1030

[main 13b32e2] Revert "Release 2026-06-25 10:30"
 Date: Fri Jun 26 00:27:39 2026 +0000
 4 files changed, 3 insertions(+), 6 deletions(-)
 delete mode 100644 db/migrate.sql
 delete mode 100644 releases/2026-06-25-1030/VERSION

$ cd /work/git-recovery-rollback && git log --oneline --decorate -4

13b32e2 (HEAD -> main) Revert "Release 2026-06-25 10:30"
de583c6 (tag: release-2026-06-25-1030) Release 2026-06-25 10:30
c15c7c6 (tag: release-2026-06-25-1000) Release 2026-06-25 10:00
ddb9d51 (tag: release-2026-06-24-1700) Release 2026-06-24 17:00
View reproducible demo details

This page shows the sanitized shell transcript and the setup steps needed to reproduce the example.

Lab setup steps

  1. cd /lab/git-recovery-rollback && git status --short && git log --oneline --decorate -3
  2. cd /lab/git-recovery-rollback && git restore -- app/config.yml && git revert --no-edit release-2026-06-25-1030
  3. cd /lab/git-recovery-rollback && git log --oneline --decorate -4

next steps

Related commands

Hosting Operations Risk: caution

Restore One File From Last Good Release

Recover a config file without rolling back the whole branch.

cd /lab/git-recovery-rollback && git restore --source=release-2026-06-25-1000 -- app/config.yml
Hosting Operations Risk: safe

Snapshot Git Status Before Recovery

Before rollback commands, capture the branch and dirty files.

cd /lab/git-recovery-rollback && git status --short --branch
Hosting Operations Risk: safe

Map Recent Release Commits

A rollback is easier when the last few release tags are visible.

cd /lab/git-recovery-rollback && git log --oneline --decorate --graph --all -8
Hosting Operations Risk: safe

Show Files Changed Since Last Good Release

Compare the suspect release against the last known-good tag.

cd /lab/git-recovery-rollback && git diff --name-status release-2026-06-25-1000..HEAD
Hosting Operations Risk: safe

Preview the Patch a Rollback Would Apply

Show the exact file changes before moving the branch back.

cd /lab/git-recovery-rollback && git diff --stat HEAD..release-2026-06-25-1000
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:provisional
  • linuxplus:troubleshooting
  • risk:production-state-change

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.