Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 648489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:50:18+00:00 2026-05-13T21:50:18+00:00

I hate seeing nearly every directory in my repository list each file twice, once

  • 0

I hate seeing nearly every directory in my repository list each file twice, once with a dot in front of it and once without. I tried adding .* to my .hgignore file, but it has no effect. Is this the wrong syntax, and more importantly, is it a bad idea to try this in the first place? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T21:50:19+00:00Added an answer on May 13, 2026 at 9:50 pm

    You’ve got almost the right answer in the comments from gavinb, but the match was a little to broad. However, key concept about ignoring after the face was provided by RogerPage, again in a comment (what’s with everyone preferring comments to answers?).

    Let’s look at these nine files:

    dir.with.dots/file.with.dots
    dir.with.dots/filewithoutdots
    dir.with.dots/.filestartwithdot
    dirwithoutdots/file.with.dots
    dirwithoutdots/filewithoutdots
    dirwithoutdots/.filestartwithdot
    .startwithdot/file.with.dots
    .startwithdot/filewithoutdots
    .startwithdot/.filestartwithdot
    

    If in the default regex mode for hgignore you do:

    \..*
    

    You ignore eight of those nine files:

    $ hg stat -i
    I .hgignore
    I .startwithdot/.filestartwithdot
    I .startwithdot/file.with.dots
    I .startwithdot/filewithoutdots
    I dir.with.dots/.filestartwithdot
    I dir.with.dots/file.with.dots
    I dir.with.dots/filewithoutdots
    I dirwithoutdots/.filestartwithdot
    I dirwithoutdots/file.with.dots
    

    which is more broad than you said you wanted. It’s ignoring anything with a dot anywhere in it.

    To ignore all files and directores (not what you said, but what you seem to want) beginning with a dot you use this regexp pattern:

    (^|/)\.
    

    which says that the thing before the literal dot has to be the start of the line (^) or a slash.

    $ hg stat -i
    I .hgignore
    I .startwithdot/.filestartwithdot
    I .startwithdot/file.with.dots
    I .startwithdot/filewithoutdots
    I dir.with.dots/.filestartwithdot
    I dirwithoutdots/.filestartwithdot
    

    That caught only files or directories that start with a dot.

    However, the other key concept that came up, was that .hgignore has no effect after a file has been added. It will prevent adding by wild card, but you can always override .hgignore with an explicit hg add. and once files have been added the hgignore is no longer consulted.

    That’s actually really handy because you can ignore broadly (ex: .*\.jar) and then add the exceptions you do want manually w/o having to futz with your hgignore file. However, in this case it means you need to hg rm the files you’ve already added accidentally, and tonfa showed how to do that (so long as there are no spaces in your filenames).

    In the end it sounds like what you want in your .hgignore file is:

    (^|/)\._
    

    and that you need to remove the ones you’ve already added:

    find . -type f -name "._*" -print0 |xargs -0 hg rm
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hate having a bunch of left/right methods. Every time a property is added
I hate to post this but I am seeing unwanted animation in an iPhone
I hate a list created by simple cursor adapter: Cursor c = myDbHelper.rawQ(select); startManagingCursor(c);
I utterly hate the inconsistency of scrollbars across browsers. After recently seeing OSX lion
I hate putting things into the functions.php file and therefore wanted to hook into
Hate to post this, but I am googled out and tried many different options
I hate blocks. They are meant to make the code more concise, but I
I hate to post this but I am on a time crunch and need
I hate writing migrations, but it's important for the schemas to stay in sync.
I hate generating an exception for things that I can simply test with an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.