cli.fail

Practice this fail.

A little less committed.

Git · Restart as often as you like

Read the error, choose a command, and learn
why it works. Nothing runs on your machine.

Browse all practice ↗

This repository already has commits. src/config.js is tracked, and you accidentally staged its latest edits. Keep those edits on disk.

A little less committed.

$ git status --short

M src/config.js

Right changes. Wrong commit.

How do you remove this file’s edits from the next commit without losing them?

3 attempts remaining

Read why this fix works

A little less committed.

git restore --staged -- src/config.js

With --staged, git restore updates only the staging area. Its default source in this mode is HEAD, so the file’s staged changes are removed while its working-tree edits remain on disk. The repository-has-commits assumption matters because HEAD must exist.

Practice rounds do not affect the daily score or local streak. Try today’s challenge, or choose another scenario.

Copy your result