Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial: How to ignore changes to a tracked file

I have a file with database settings in my project which I have set to some defaults. The file is tracked by Mercurial and checked in. Since this file will be edited with different values various developer machines, is there a way I can tell Mercurial to ignore new changes to this file?

I tried adding the file to the .hgignore file, but since the file is tracked it isn't ignored. This is alright and good in other situations, but I am wondering if there is something I can do here?

like image 610
Svish Avatar asked May 18 '10 11:05

Svish


People also ask

How to remove file from hg?

Once you decide that a file no longer belongs in your repository, use the hg remove command. This deletes the file, and tells Mercurial to stop tracking it (which will occur at the next commit). A removed file is represented in the output of hg status with a “ R ”.

How do you Untrack a file in Heartgold?

If you see the help for hg rm --help : hg remove [OPTION]... FILE... Schedule the indicated files for removal from the current branch. This command schedules the files to be removed at the next commit.

What is Hgignore?

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.


2 Answers

Using a file template is definitely the best solution. For example, if you have a database.ini file, commit a database.ini.template file and ignore database.ini in .hgignore

like image 121
yanjost Avatar answered Nov 26 '22 09:11

yanjost


If you always want to ignore the file, you can add the -X option as a default for commit to your .hg/hgrc configuration file:

[defaults] commit = -X program.conf 
like image 36
sth Avatar answered Nov 26 '22 10:11

sth