Signal9Signal9 — home
online
back to labs

Git: Undo a Pushed Commit Without Rewriting History

MediumLFCS Prep20 min
The brief

During last week's outage someone committed and pushed a change that turned debug = true on in production and added a debug-dump.sh script that writes request bodies to /tmp. A useful commit has landed on top of it since, and the whole team has already pulled.

The shared repository is /srv/git/inventory.git (a bare repo standing in for the team's Git server). Work in your own clone of it:

1. Undo everything the bad commit changed, so main has debug = false again and no debug-dump.sh, while keeping the good commit that came after it. Do not rewrite history the team has already pulled: main on the server must still contain every commit it has now.

2. Mark the fixed state as release v1.4.1 with an annotated tag on main.

3. Push both main and the tag to the shared repository.

Grading reads /srv/git/inventory.git only: its main branch, its history and its tags. Nothing in your clone counts until it is pushed.

What you'll do
  • Clone a repository and read its history
  • Find the commit that introduced a change
  • Undo a published commit with a new commit instead of rewriting history
  • Create an annotated tag and push branches and tags to a remote

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.