---
name: "hg-forget"
section: "1"
platform: "linux"
package: "mercurial"
version: "7.2.4-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/hg-forget"
---

# hg-forget(1)

forget the specified files on the next commit

## NAME

hg forget - forget the specified files on the next commit

## SYNOPSIS

```
hg forget [OPTION]... FILE...
```

## DESCRIPTION

Mark the specified files so they will no longer be tracked after the next commit.

This only removes files from the current branch, not from the entire project history, and it does not delete them from the working directory.

To delete the file from the working directory, see **hg remove**.

To undo a forget before the next commit, see **hg add**.

Examples:

- •

  forget newly-added binary files:

  ```
  hg forget "set:added() and binary()"
  ```

- •

  forget files that would be excluded by .hgignore:

  ```
  hg forget "set:hgignore()"
  ```

  Returns 0 on success.

## OPTIONS

- **-i, --interactive**

  use interactive mode

- **-I,***--include* **\<PATTERN\[+\]\>**

  include names matching the given patterns

- **-X,***--exclude* **\<PATTERN\[+\]\>**

  exclude names matching the given patterns

- **-n, --dry-run**

  do not perform actions, just print output

  \[+\] marked option can be specified multiple times
