When dealing with files that you don't want to commit you can have these situations:
File is not being tracked by mercurial
This means that you've created it while working on you local copy and it is not in any previous revision of code.
In this case you can add it to
.hgignore. This is a file in the root of a repository.
What if you don't want to commit
.hgignore or to push changes of it for some reason. Then you can include external ignore list in you local repo.
Assuming that you are in the root of your repository type:
Or use whatever editor you like. On windows use
notepad .hg/hgrc etc.
Add this line:
[ui] ignore = ~/path/to/repo/.hg/hgignore
then create that
and define which files should be ignored. For example:
File is being tracked by mercurial but you don't want to commit changes - no solution
I've found few solutions and none of them are completely useful.
For example commit only those files you want link.
hg commit -I foo.c -I "**/*.h"
Other is to exclude files you don't want to commit.
hg commit -X file.txt
There is a trick with this approach. You can configure mercurial (
.hg/hgrc) to do excludes by default:
[defaults] commit = -X program.conf
But this doesn't work if you are in sub folder. Then you need to add absolute path to the file.
[defaults] commit = -X ~/path/to/repo/program.conf
There is also ExcludeExtension. After installing it I though that everything is fine but then I was getting this message
cannot partially commit a merge. Well on a home page of the extension there is a warning but didn't read, so this is expected. Also one note to this - SourceTree was acting funny. I couldn't see connections between revisions/branches and I always had Uncommited changes with no files listed.
Read here under the Alternatives. To paraphrase it - you need to have
config.ini.template and ignore
config.ini which will be created by developer.
Does anyone know how to solve this problem?