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

  • Home
  • SEARCH
  • 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 4100030
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:30:48+00:00 2026-05-20T20:30:48+00:00

So, after converting my repository to git and doing the first build, some build

  • 0

So, after converting my repository to git and doing the first build, some build directories showed up in git status:

# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   build.xml
#       modified:   src/ant/common-tasks.xml
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       classes/
#       doku/
#       texdoku/
#       tmp/

So, of course I need a .gitignore, and since I didn’t want to type these directory-names again, I used this command:

git status -s | grep '?' | cut -b 4- > .gitignore

Since git status -s showed this

 M build.xml
 M src/ant/common-tasks.xml
?? classes/
?? doku/
?? texdoku/
?? tmp/

before, I assumed the new .gitignore file to contain these lines:

classes/
doku/
texdoku/
tmp/

But then:

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   build.xml
#       modified:   src/ant/common-tasks.xml
#
no changes added to commit (use "git add" and/or "git commit -a")

Yes, it ignored the four directories, but also the new .gitignore file. Why?

$ git add .gitignore
The following paths are ignored by one of your .gitignore files:
.gitignore
Use -f if you really want to add them.
fatal: no files added

Huh. Why is my .gitignore ignored? I remember that in the last project I could add it to the repository. I searched quite a time, and googled what else could cause this file to be ignored – .git/info/excludes has only commented lines, and all parent-directories up to / have no .gitignore. Also git config core.excludesfile shows nothing.

Why?

  • 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-20T20:30:48+00:00Added an answer on May 20, 2026 at 8:30 pm
    git status -s | grep '?' | cut -b 4- > .gitignore
    

    The > .gitignore redirection at the end of the pipeline created the .gitignore file before git status did its directory listing. So, in fact the result was

    .gitignore
    classes/
    doku/
    texdoku/
    tmp/
    

    which got written in the .gitignore file. Thus, the .gitignore ignored itself. Editing the file to remove the first line solved the problem, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After converting my repository to Git using git-svn, I'm seeing both the original master
After converting an ASP.NET webform (v3.5) to use a master page, I started getting
After converting to Visual Studio 2010 with ReSharper5 some of my unit tests started
After reading the Head First Design Patterns book and using a number of other
Summary: I'm having some svn trouble, and after debugging it for a while, I'm
After converting a Hybrid ASP.NET MVC1 app to MVC2 I'm getting the following error
After converting a VS 2005 project to VS 2008 I started encountering the following
I have trouble in setting the equal condition on a datetime field after converting
Getting this after solving a Error converting data type nvarchar to datetime error. Using
We're converting some .NET 3.5 code to Java (Android). This Java code gives the

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.