Back to lessons

Hosting Operations

Restore One File From Last Good Release

One file is dirty or suspect, and you want to restore just that path from a known-good release tag.

Command

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

What changed

app/config.yml in the disposable repo is replaced with the version from release-2026-06-25-1000.

Danger

caution

When to use it

Use when you need a targeted file recovery from a tag, commit, or branch.

When not to use it

Do not run this on a path with uncommitted work you still need unless you have saved or reviewed the diff.

Undo or recovery

Restore the file again from HEAD or discard the disposable fixture copy.

Expected output

The diff for app/config.yml changes after the targeted restore.

demo script

Disposable terminal steps

  1. cd /lab/git-recovery-rollback && git diff -- app/config.yml
  2. cd /lab/git-recovery-rollback && git restore --source=release-2026-06-25-1000 -- app/config.yml
  3. cd /lab/git-recovery-rollback && git diff -- app/config.yml

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ cd /lab/git-recovery-rollback && git diff -- app/config.yml
diff --git a/app/config.yml b/app/config.yml
index 587c07b..eb4e72d 100644
--- a/app/config.yml
+++ b/app/config.yml
@@ -1,2 +1,3 @@
 version=1.2
 feature_flag=checkout-redesign
+debug_logging=true
::exit-code::0
$ cd /lab/git-recovery-rollback && git restore --source=release-2026-06-25-1000 -- app/config.yml
::exit-code::0
$ cd /lab/git-recovery-rollback && git diff -- app/config.yml
diff --git a/app/config.yml b/app/config.yml
index 587c07b..8be1a2f 100644
--- a/app/config.yml
+++ b/app/config.yml
@@ -1,2 +1,2 @@
-version=1.2
-feature_flag=checkout-redesign
+version=1.1
+feature_flag=off
::exit-code::0

YouTube Short

Restore one file from a tag.

You do not always need a full rollback. Restore one known-good file from the release tag and review the diff.

LinkedIn hook

Recover a config file without rolling back the whole branch.

Question: Do you use targeted file restores during release incidents?

experiments

A/B tests to run

Metric: completion_rate

A: Restore one file, not the whole repo.

B: Known-good tags can recover files.