开发者

Add ignore tag to file so it can't be added to repo accidentally?

开发者_如何学JAVAI'm using mercurial for a project. I want to ignore a file within the project folder so it cannot be added to source control accidentally. Looks like:

/myproject 
   /src
     private.cpp
     public.cpp

so I want to explicitly ban private.cpp from ever being added, is that possible?

Thanks


You can use the hgignore file to specify files that are ignored for automatic operations (like hg addremove). This won't stop someone from explicitly adding the file via hg add src/private.cpp. You would have to use hooks to completely block commits containing that file though.


Sure it's possible. You need to add the path you wish to ignore as a filter in your .hgignore file for that repository. In the above, if your "myproject" folder is the repository, add the .hgignore there with this line in it:

*\src\private.cpp

For more information on how to use the .hgignore file look here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜