20131002 using hgignore - plembo/onemoretech GitHub Wiki

title: Using .hgignore link: https://onemoretech.wordpress.com/2013/10/02/using-hgignore/ author: phil2nc description: post_id: 6432 created: 2013/10/02 09:48:25 created_gmt: 2013/10/02 13:48:25 comment_status: closed post_name: using-hgignore status: publish post_type: post

Using .hgignore

If you're tracking changes in your source code using Mercurial, you'll probably find using an .hgignore file helpful. The function of .hgignore, like its close cousin, .gitignore, is to to allow you to exclude certain files from being tracked by the source control system. Transient or "variable" files like logs, temporary files and user contributed images are top candidates for such treatment. Fortunately the syntax for .hgignore follows already established conventions. For example, its regular expression method will be familar to those who work with regexes in perl, java and other languages. There are lots of helpful articles on the Internet on the topic, as you can see from this compilation. Here's an example from real life:

# Use glob syntax
syntax: glob
*.log

# Switch to regex syntax
syntax: regexp
storage/views/.+
public/.sass-cache/.+
public/img/profiles/A.+\.jpg
public/img/profiles/Z.+\.jpg
public/img/thumbnails/A.+\.jpg
public/img/thumbnails/Z.+\.jpg
public/img/temp/.+

Copyright 2004-2019 Phil Lembo