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 6736121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:05:34+00:00 2026-05-26T11:05:34+00:00

I have a .gitignore file in a few directories (ex. log/ ) with the

  • 0

I have a .gitignore file in a few directories (ex. log/) with the following contents:

*            " Ignore everything in this directory
!.gitignore  " Except this file

Nonetheless, if there is a file in that directory, git status shows it to me saying it’s new but untracked.

# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       log/blah.log
nothing added to commit but untracked files present (use "git add" to track)

I have found other posts on stackoverflow suggesting putting a comment on the first line and various other forms or random voodoo, but nothing has worked.

Simply, I want a tmp/ and log/ directory to exist in my repo, but empty. I don’t want anyone to be harassed to add their log and tmp files to these directories.

  • 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-26T11:05:35+00:00Added an answer on May 26, 2026 at 11:05 am

    Are you expecting the double-quote to act like a comment in your
    .gitignore file? You’ve got this…

    *            " Ignore everything in this directory
    !.gitignore  " Except this file
    

    …but that’s doing what you want. If you replace it with simply:

    *
    !.gitignore
    

    It will work just fine. Watch:

    $ ls -A
    dir1 .git
    $ ls -A dir1
    .gitignore
    $ cat dir1/.gitignore
    *
    !.gitignore
    $ git status
    # On branch master
    nothing to commit (working directory clean)
    $ touch dir1/file{1,2,3}
    $ ls -A dir1
    file1 file2 file3 .gitignore
    $ git status
    # On branch master
    nothing to commit (working directory clean)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .gitignore file in my project directory and I placed the following
I have a gitignore file that makes git ignore *.dll files, and that is
I have the following .gitignore file *.pyc project/app/dist/* project/bin/* project/etc/* project/var/* !README.txt So far
I have the following line in my .gitignore file: var/www/docs/.backroom/billing_info/inv.pl but when I type
My .gitignore file has the following line vendor/ I have modified a file inside
I have the following .gitignore file # file named .gitignore system/application/config/database.php system/application/config/config.php system/logs modules/recaptcha/config/*
I have a .gitignore file in my repo. #DB Ignore db_connect.php #Environment Banner template.php
this is probably naive question: i have file config.yml which is in .gitignore file
I have created a .gitignore file in the folder with the .git folder, but
Have you managed to get Aptana Studio debugging to work? I tried following this,

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.