Back to lessons

Hosting Operations

Risk: safe

Preview the Patch a Rollback Would Apply

You know the last good release tag, but you want to inspect what a rollback would remove before changing anything.

Command

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

Before you run this

Risk: safe. Do not treat a small diff as automatically safe; migrations, config, and external state still need review.

Expected output

A diffstat showing the config, migration, public page, and release metadata changes that rollback would remove.

System impact

Nothing changes. Git prints the patch summary from the current commit back to the last good release.

Recovery / rollback: no state is changed.

When to use it

Use before reset, revert, or deploy rollback when you need a quick preview of the files and line counts involved.

When not to use it

Do not treat a small diff as automatically safe; migrations, config, and external state still need review.

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 diff --name-status HEAD..release-2026-06-25-1000

M	app/config.yml
D	db/migrate.sql
M	public/index.html
D	releases/2026-06-25-1030/VERSION

$ cd /work/git-recovery-rollback && git diff --stat HEAD..release-2026-06-25-1000

 app/config.yml                   | 4 ++--
 db/migrate.sql                   | 1 -
 public/index.html                | 2 +-
 releases/2026-06-25-1030/VERSION | 2 --
 4 files changed, 3 insertions(+), 6 deletions(-)
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 diff --name-status HEAD..release-2026-06-25-1000
  2. cd /lab/git-recovery-rollback && git diff --stat HEAD..release-2026-06-25-1000

next steps

Related commands

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: 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: caution

Revert the Suspect Release Commit

Undo a bad release with a new commit instead of rewriting history.

cd /lab/git-recovery-rollback && git restore -- app/config.yml && git revert --no-edit release-2026-06-25-1030
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

Snapshot Git Status Before Recovery

Before rollback commands, capture the branch and dirty files.

cd /lab/git-recovery-rollback && git status --short --branch
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.

  • lpic1:103-gnu-unix-commands
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • risk:read-only

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.