Search code examples
gityiigitignore

.gitignore file with yii framework


I have a yii 1 application. And I have a .gitignore file in the folder: Yii/sdi. The file .gitignore looks like this:

assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db

But by source control there are still 10K changes, for example this files in the folder:

C:\xampp\htdocs\yii\sdi\protected\components\widgets\select2\assets\js\i18n

So what I have to change in the .gitignore file?

Thank you

I deleted the folder SDI. So I have it now directly in the root folder - all the other folders.

And I have the .gitignore file like this:

# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
/vendor

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml

tests/_output/*
tests/_support/_generated

#vagrant folder
/.vagrant

protected/components/widgets/select2/assets/*

assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db

And the .gitignore file is in the .idea folder

So Webscraper is root folder then in the root folder I have a .idea folder. and in the .idea folder there I have the .gitignore file.

oke, if I do this:

!.gitignore

protected/components/widgets/select2/assets/*

# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

# phpstorm project files
.idea

# netbeans project files
nbproject

# zend studio for eclipse project files
.buildpath
.project
.settings

# windows thumbnail cache
Thumbs.db

# composer vendor dir
vendor/

# composer itself is not needed
composer.phar

# Mac DS_Store Files
.DS_Store

# phpunit itself is not needed
phpunit.phar
# local phpunit config
/phpunit.xml

tests/_output/*
tests/_support/_generated

#vagrant folder
/.vagrant


.protected/vendor/*

assets/*
!assets/.gitignore
protected/runtime/*
!protected/runtime/.gitignore
protected/data/*.db


still have 9K plus changes


Solution

  • Your .gitignore-file is in the directory /sdi and you want to ignore the assets-folder, where is reachable from sdi-folder via protected/components/widgets/select2/assets.

    So why you just add assets/* to the .gitignore in the sdi directory? This would ignore a assets-folder in the directory /sdi where there is none!

    So add the FULL path (relative path) to the folder/file where you want to ignore. In your example:

    protected/components/widgets/select2/assets/*
    

    After this entry, you won‘t have 10k of changes in your git working directory