# How to Reset a Rustlings Exercise Progress: 3 Methods Explained

> Easily reset Rustlings exercise progress. Learn 3 methods to clear completion status or reset specific exercises interactively using rustlings reset watch or list commands.

- Repository: [The Rust Programming Language/rustlings](https://github.com/rust-lang/rustlings)
- Tags: how-to-guide
- Published: 2026-03-05

---

**Run `rustlings reset` in your terminal to clear the current exercise's completion status, or press `x` during `rustlings watch` and `r` in `rustlings list` to reset specific exercises interactively.**

The `rust-lang/rustlings` repository provides an interactive command-line interface for learning Rust, tracking your completion status in a hidden state file. Whether you need to restart a challenging exercise or clear your progress to practice again, understanding how to reset a Rustlings exercise progress ensures you can repeat lessons without manually editing configuration files.

## Where Rustlings Stores Exercise Progress

Before resetting, it helps to understand how the tool persists your progress. Rustlings creates a hidden file named **[`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt)** inside the generated `rustlings/` directory. This file tracks which exercises you have marked as completed.

When you invoke any reset command, the application updates this state file to mark the target exercise as *not completed*, allowing you to attempt it again while preserving your actual source code.

## How to Reset a Rustlings Exercise Progress

The Rustlings CLI provides three distinct interfaces for resetting progress, depending on your current workflow.

### Reset the Current Exercise via CLI

The most direct method uses the `reset` subcommand. According to the source code in [`src/main.rs`](https://github.com/rust-lang/rustlings/blob/main/src/main.rs) (line 180), this command invokes `AppState::reset_current_exercise`, which clears the state for the exercise currently selected in your session.

```bash
$ rustlings reset
The exercise exercises/01_variables/variables1.rs has been reset

```

This command targets the exercise shown in your current prompt or the last exercise you interacted with.

### Reset While in Watch Mode

When running `rustlings watch`, the interactive UI monitors your code changes and provides keyboard shortcuts for common actions. The watch mode implementation in [`src/watch/state.rs`](https://github.com/rust-lang/rustlings/blob/main/src/watch/state.rs) (line 113) captures the **`x`** keystroke to trigger a reset.

```bash
$ rustlings watch

# ... progress bar shows current file ...

# Press `x`

resetting the current exercise...
The exercise exercises/02_functions/functions1.rs has been reset

```

This method allows you to reset without leaving the watch environment, immediately letting you reattempt the exercise while the file watcher remains active.

### Reset From the Interactive List

The list view provides a browseable interface to all exercises. In [`src/list/state.rs`](https://github.com/rust-lang/rustlings/blob/main/src/list/state.rs) (line 361), the application handles the **`r`** key to reset the currently highlighted exercise.

```bash
$ rustlings list

# Use arrow keys to highlight an exercise

# Press `r`

resetting selected exercise...
The exercise exercises/03_data_types/data_types1.rs has been reset

```

This approach works best when you need to reset a specific exercise that is not currently loaded in your session.

## The Core Reset Logic in the Source Code

All three interfaces converge on the same underlying implementation in [`src/app_state.rs`](https://github.com/rust-lang/rustlings/blob/main/src/app_state.rs). The `reset` method (lines 312-322) handles the actual state modification:

```rust
// src/app_state.rs
pub fn reset(&mut self, exercise_ind: usize, exercise_path: &str) -> Result<()> {
    // Updates .rustlings-state.txt to mark exercise as not completed
    self.state.update_exercise(exercise_ind, false)?;
    // ... file I/O operations ...
}

```

The `reset_current_exercise` method (lines 339-345) provides a convenience wrapper that identifies the active exercise index and delegates to the core `reset` function:

```rust
pub fn reset_current_exercise(&mut self) -> Result<&str> {
    self.reset(self.current_exercise_ind, &exercise.path)?;
    // Returns the path for CLI feedback
}

```

This architecture ensures that whether you press `x` in watch mode, `r` in list mode, or type `rustlings reset`, the application consistently updates [`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt) to reflect the reset status.

## Summary

- Rustlings stores completion data in **[`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt)** within the `rustlings/` directory.
- **Three methods** exist to reset a Rustlings exercise progress: the `rustlings reset` CLI command, pressing **`x`** during `rustlings watch`, and pressing **`r`** in `rustlings list`.
- All reset operations invoke `AppState::reset` in [`src/app_state.rs`](https://github.com/rust-lang/rustlings/blob/main/src/app_state.rs) (lines 312-322) to update the state file.
- Resetting marks the exercise as not completed without deleting your source code, allowing immediate reattempts.

## Frequently Asked Questions

### Does resetting a Rustlings exercise delete my code?

No. Resetting only modifies the **[`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt)** file to mark the exercise as incomplete. Your actual solution code in the exercise files remains untouched, allowing you to review or modify your previous attempts while clearing the completion status.

### Can I reset all exercises at once?

The current implementation in `rust-lang/rustlings` does not provide a single command to reset all exercises simultaneously. You must reset exercises individually using `rustlings reset`, the `x` key in watch mode, or the `r` key in list mode. To start completely fresh, you could manually delete the [`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt) file, though this is not the recommended workflow.

### Why does `rustlings reset` say "No exercise selected"?

This error occurs when you invoke `rustlings reset` without having an active exercise context. The `reset_current_exercise` method in [`src/app_state.rs`](https://github.com/rust-lang/rustlings/blob/main/src/app_state.rs) requires a current exercise index to determine which state entry to clear. Run `rustlings watch` or `rustlings list` first to establish context, or use the list view to select and reset a specific exercise.

### Is there a way to undo a reset?

No built-in undo functionality exists in the Rustlings CLI. Once you reset an exercise using any of the three methods, the state file immediately updates to mark it as incomplete. If you need to restore a previous completion status, you would need to manually edit the [`.rustlings-state.txt`](https://github.com/rust-lang/rustlings/blob/main/.rustlings-state.txt) file or re-complete the exercise.