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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:51:48+00:00 2026-06-16T08:51:48+00:00

I’ve just downloaded (not cloned!) CakePHP 2.2.4. The directory containains a .gitignore file: #

  • 0

I’ve just downloaded (not cloned!) CakePHP 2.2.4.
The directory containains a .gitignore file:

# only the relevant part here
/app/Config
/app/tmp

Now I executed these command because the directories (and their initial contents) Config and tmp would otherwise never been committed:

git add -f Config
git add -f tmp

I have no problems with the tmp directory because no files are changed there, only new files will be created!

In contrast, I had to modify some files (e.g. database configuration) in the Config folder.
But Git now wants me to git add these modified files again!

How can I ignore these modifications?

I could also reinit the whole Git repo because I didn’t created/modified too much.


My modifications to CakePHP for solving the actual problem

My new *.gitignore file for CakePHP:

# removed: /app/Config/

# start edit
/app/Config/*
!/app/Config/Schema/
!/app/Config/*.default.php
# end edit

/app/tmp
/lib/Cake/Console/Templates/skel/tmp/
/plugins
/vendors
/build
/dist
.DS_Store
/tags

I’ve also suffixed all files in /app/Config with .default:

  • acl.ini.default.php.

  • acl.default.php.

  • bootstrap.default.php.

  • core.default.php.

  • database.php.default –> database.default.php

  • email.php.default –> database.default.php

Edit: It’s better to have *.default.php than *.php.default because this prevents outputting the file to the browser if mod_rewrite fails (though that’s very unlikely).

  • 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-06-16T08:51:49+00:00Added an answer on June 16, 2026 at 8:51 am

    Git does not track directories; only files. So when you run git add -f Config, git is simply adding all files in the working tree beneath Config, not the directory itself. Since these files are then tracked by Git (thus overriding the ignore rules), changing them will cause Git to consider the working tree dirty.

    These rules for Config and tmp exist in CakePHP’s .gitignore file because the entire directory can effectively be ignored by Git; there’s no need to explicitly create empty directories, since CakePHP will presumably create them automatically.

    If for some reason you want Git to know that there should be a directory there, but to ignore its contents, then you can add a .gitignore file inside Config and tmp containing the the rule *, which will tell it to ignore everything iside that directory. Since the .gitignore file is there, however, it’ll maintain the directory itself.


    Update: If you want to store a “default” config in Git that is to be customised on a per-working-copy basis, you’re better off committing a template config file under a different name that can be copied to a new (ignored) file when the repository is cloned and populated with environment-specific config options.

    As I see it, the config files themselves shouldn’t be kept under version control, since they need to be tailored to the environment in which the working copy is being used, so keeping template copies in this way seems the natural solution (this is what WordPress does).

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
In my XML file chapters tag has more chapter tag.i need to display chapters
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.