Challenges · Recovery

Undo Last Commit

0/4

Challenge

beginner

Undo Last Commit

Scenario

Your last commit, Add API config, accidentally included secrets.env, which holds a real API key. Luckily you have not pushed yet, so the commit can still disappear from history.

Mission

Rewrite the last commit so that config.js is committed but secrets.env never was, ignore secrets.env from now on, and keep history to two commits.

Objectives

0/4
  1. secrets.env is no longer tracked. (Current objective)
  2. config.js is committed. (Not started)
  3. The working tree is clean, with secrets.env ignored. (Not started)
  4. History still has exactly two commits, so the key is in none of them. (Not started)

Your task nowStep 1 of 4

secrets.env is no longer tracked.

Need help?

Preparing your workspace…

Repository Graph

Click a commit to inspect it

0 commits

Working Tree

Not a Git repository yet

No unstaged changes

Your working tree matches the staging area.

Staging Area

Files prepared for the next commit

No staged changes

Use git add to prepare files for your next commit.

Repository

Committed history

No commits yet

Use git commit to record staged changes.