Search code examples
version-controlmercurialcommitdelete-filerevert

Deleted some files being versioned by Mercurial, how do I commit those deletes?


I deleted a few files on my local filesystem which I am not using anymore and are just junk. Unfortunately they are tracked by version control (Mercurial). Now I see a large red '!' saying it is out of sync because of the missing files. How can I tell Mercurial that it's OK to remove those files without reverting all of them and selecting delete on them individually?


Solution

  • Either tell it to forget those files:

    hg forget XYZ
    hg commit ...
    

    Or use the addremove command, or addremove option for commit:

    hg addremove
    Hg commit ...
    

    Or

    hg commit --addremove ...
    

    Use the help to find more info on these commands:

    hg help forget
    hg help commit