# How Do I Remove a Single File From the Staging Area (Undo Git Add)?

If you've added a file to the staging area with `git add` but want to remove it from the staging area without affecting your working directory (i.e., undo the `git add`), you can use the `git reset` command. Here’s how to do it:

### Removing a Single File from the Staging Area

### Using `git reset` for a Specific File

To unstage a single file:

```
git reset <file>
```

For example, if you added `example.txt` to the staging area and want to unstage it:

```
git reset example.txt
```

This command will remove `example.txt` from the staging area, but it will not delete or modify the file in your working directory. The changes you made to `example.txt` will still be present, but it will no longer be included in the next commit.

### Verifying the Change

To confirm that the file has been removed from the staging area:

1. **Check the Status**: Use `git status` to see the current state of the working directory and the staging area.
    
    ```
    git status
    ```
    
    The file `example.txt` should now appear under "Changes not staged for commit" instead of "Changes to be committed".
    
2. **Check the Staging Area**: To further verify, you can use `git diff --cached` to show the differences between the staged changes and the last commit. The file should no longer appear in this output.
    
    ```
    git diff --cached
    ```
    

### Example Scenario

1. **Add a File to Staging Area**:
    
    ```
    git add example.txt
    ```
    
2. **Unstage the File**:
    
    ```
    git reset example.txt
    ```
    
3. **Verify**:
    
    ```
    git status
    ```
    
    The file `example.txt` should now be listed under "Changes not staged for commit".
    

### Summary

To remove a single file from the staging area without affecting the working directory:

- Use `git reset <file>` to unstage the file.

This approach allows you to selectively manage which changes are staged for the next commit and helps keep your commit history clean and precise.