Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hg - Ignore directory at root only

In my project's .hgignore, I want to exclude /static/ (i.e., the static folder at the root of the directory), but not /templates/static/. How would I configure .hgignore to allow this?

like image 865
BenGC Avatar asked Jan 29 '12 05:01

BenGC


People also ask

What is hgignore file in Linux?

Introduction The .hgignore file sits in the working directory, next to the .hg folder. It is a file versioned as any other versioned file in the working directory, which is used to hold the content of the ignore patterns that are used for any command operating on the working directory.

How do I ignore a file in the working directory?

These files can be ignored by listing them in a .hgignore file in the root of the working directory. The .hgignore file must be created manually.

What is hgignore in mercurial?

The Mercurial system uses a file called .hgignore in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking. The working directory of a Mercurial repository will often contain files that should not be tracked by Mercurial.

How do I ignore files in the working directory of mercurial?

The working directory of a Mercurial repository will often contain files that should not be tracked by Mercurial. These include backup files created by editors and build products created by compilers. These files can be ignored by listing them in a .hgignore file in the root of the working directory. The .hgignore file must be created manually.


2 Answers

You can include syntax: regexp at the beginning of .hgignore and then use perl regex syntax to root a directory by using ^. So just ^static should do the work.

like image 66
clime Avatar answered Oct 26 '22 16:10

clime


As of Mercurial 4.9, you can use syntax: rootglob to insert rooted glob patterns.

New rootglob: filename pattern for a glob that is rooted at the root of the repository. See hg help patterns and hg help hgignore for details

like image 35
Raphaël Gomès Avatar answered Oct 26 '22 15:10

Raphaël Gomès