简体   繁体   中英

Git: ignoring files after deleting .gitignore file

I had a magento setup in which I created a .gitignore file which is like as follows:

########   MAGENTO RELATED FILES AND FOLDERS    ######
var/*
media/*
app/etc/local.xml
minified/css/*
minified/css_secure/*
minified/js/*
minified/media/*

later I figured out that due to this rule var and media dirs also got ignored and were not part of commit. So I tried to comment var/* and media/* lines, I tried to delete, the .gitignore file, committed and pushed to remote repo. but nothing works.

Any chance to get them back under tracking? Please note there is only one .gitignore file.

Many thanks!!

git tracks content; directories are not content, they are structure. What you can do is, drop empty placeholder files in var/ and media/ and track those. That will bring the directory structure under git's supervision.

You can keep the var/* and media/* lines in your .gitignore, just add an exception for the placeholder files like

!var/README.md
!media/README.md

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM