# How Do I Discard Unstaged Changes in Git?

To discard unstaged changes in Git, you have a few options depending on your specific requirements:

### Discard Changes in a Single File:

If you want to discard changes in a single file and revert it to the last committed version:

```bash
git checkout -- <file>
```

Replace `<file>` with the name of the file you want to discard changes for.

### Discard Changes in All Untracked and Modified Files:

If you want to discard changes in all modified and untracked files:

```bash
git reset --hard
```

This command will discard all changes in your working directory and staging area and revert your repository to the state of the last commit.

### Discard Changes in Modified Files Only:

If you want to keep any new files or changes that have been added to the staging area, but discard changes in modified files:

```bash
git checkout .
```

This command will discard changes in all modified files in the working directory, leaving the staging area and new files unchanged.

### Note:

- Be cautious when using `git reset --hard` as it will discard all changes permanently, including untracked files.
- Use `git checkout -- <file>` or `git checkout .` if you want to selectively discard changes in specific files or only discard changes in modified files while keeping changes in the staging area.
- Always double-check and ensure that you don't need any of the changes you're discarding, as they cannot be recovered after discarding.