If and only if this repository has not been deleted in wild , you can delete the file from the history, essentially cloning it into a new repository, while filtering a confidential file in the process using hg convert Hg Convert Extension doc here
Usually we find something when we check the repository before publishing or delivering it to the client, such as a web.config or ini file with a password.
The extension is not enabled by default, but is enabled in all my clients, you need to enable it before Mercurial recognizes the convert command.
If you are using Tortoise Hg or Kiln, for example:
- Open Tortoise Hg → Global Settings → Extensions
- Check the box next to "Convert"
- Click ok
Or edit Mercurial.ini directly:
[extensions] convert =
Go to the directory above your repository (in my example, my repos are HelloApp):
Create a file called filemap.txt
Add a string with the full path to the name of the file you want to exclude.
exclude HelloApp/sensitive.config
Open the cd command line in the same directory containing the filemap.txt file and run hg convert
cd C:\projects hg convert --filemap filemap.txt HelloApp HelloApp_clean
Then get the latest working copy:
cd HelloApp_clean hg update
You will need to create a new clone on your server with your clean copy.
source share