Would like to create some defaults for my .hgignore files in TortoiseHG/Mercurial

I’d like to make it so that every time I create a new repository, certain filters automatically get added to my .hgignore files by default.

For example, for C# projects, I would like these to be added:

  • Choosing a version control system for a simple web site
  • So “tags” for versions and “branches” for new features?
  • Suggestions for Distributed Version Control in Eclipse
  • Mercurial clone from a branch
  • pushing a git repo fails with error: contains '.git'
  • What is the recommended source control ignore pattern for Seam projects?
  • glob:bin/*

    Is this possible? How?

    If it can’t be automated, is it at least safe to copy the .hgignore file from one repository to another?

  • Can I mark a branch as 'not going to push'?
  • Version-control: svcmap, disco, xsd, wsdl, svcinfo and datasource files
  • Add Github remote to GitKraken
  • Branch/change not merged, though Gerrit claims, it is
  • Autocreate directories when building
  • BitBucket.org - limitations only number of users?
  • 4 Solutions collect form web for “Would like to create some defaults for my .hgignore files in TortoiseHG/Mercurial”

    I use ~/.hgignore and just cp that into my repo.

    In my ~/.hgrc:

    ignore.other = ~/.hgignore

    I just put the really obvious stuff in that one. And copy it for project specific stuff.

    I don’t think its quite what you’re asking for as there is no automation, but it does the trick.

    Windows users, see Ry4an’s comment below.

    Just to clarify, it is safe to copy a .hgignore from one repos to another, it is just a plain old simple text file.

    You could use a post-init hook to do it for you:

    post-init.ignore-bin = echo 'glob:bin/*' >> .hgignore
    post-init.ignore-obj = echo 'glob:obj/*' >> .hgignore

    This form only works with the mkdir sample && cd sample && hg init style of creating a repo If you use the faster hg init sample form it will dump the new .hgignore file into the current directory.

    You could write a more intelligent hook script if you prefer using hg init name.

    hg add .hgignore ?

    Perhaps you could clone from a repo that only had that file checked in. 🙂

    Otherwise you’d have to write a small extension that did this in hg init somehow

    Git Baby is a git and github fan, let's start git clone.