[Bug 6816] New: Command to remove all tracked changes

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue May 9 15:59:32 UTC 2023


https://bz.mercurial-scm.org/show_bug.cgi?id=6816

            Bug ID: 6816
           Summary: Command to remove all tracked changes
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: All
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: jaraco at jaraco.com
                CC: mercurial-devel at mercurial-scm.org
    Python Version: ---

There appears to be no simple way to "revert to the last committed state but
retain untracked changes" as one can do in git.

Consider this case:

```
 foo main $ mkdir tmp
 foo main $ touch tmp/tmp
 foo main $ git add .
 foo main $ mkdir bar
 foo main $ touch bar/tmp
 foo main $ git reset --hard
 foo main $ git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        bar/

nothing added to commit but untracked files present (use "git add" to track)
 foo main $ tree
.
└── bar
    └── tmp

2 directories, 1 file
```

Mercurial users have `hg revert --all` and `hg update --clean`, but both of
those leave added files as untracked, making them indistinguishable from
previously untracked files and thus making a subsequent `hg purge` a risky
recommendation. 

Users wish to revert all tracked files including to remove any tracked added
files (comparable to `git reset --hard` or `hg commit -m "saved"; hg strip
--no-backup -r .`).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list