правильная настройка .gitignore, чтобы git игнорировал файлы после того, как не сказал им включать их - PullRequest
0 голосов
/ 06 ноября 2019

Я пытаюсь выяснить, как изменить мой файл .gitignore для работы с этим исходным деревом.

Код поставщика на одном уровне и пользовательский код в папке в папке пользовательского кода. Только пользовательский код должен быть зафиксирован, код поставщика должен игнорироваться. Итак, это то, что у меня есть в моем файле .gitignore, и оно работает, по большей части:

hybris/bin/*
!hybris/bin/custom/

Если я понимаю две строки, первая говорит игнорировать ВСЕ в hybris / bin, затем втораяскажем, «кроме пользовательской папки». В пользовательской папке есть несколько файлов, которые необходимо исключить: .springBeans и .project. Когда я делаю git-статус, я вижу следующее:

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   hybris/bin/custom/cnbs/cnbsinitialdata/.springBeans

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   .gitignore
    modified:   hybris/bin/custom/cnbs/cnbscore/.springBeans
    modified:   hybris/bin/custom/cnbs/cnbsfacades/.springBeans
    modified:   hybris/bin/custom/cnbs/cnbsfulfilmentprocess/.springBeans
    modified:   hybris/bin/custom/cnbs/cnbsstorefront/.springBeans
    modified:   hybris/bin/custom/cnbs/cnbsstorefront/extensioninfo.xml
    modified:   hybris/bin/custom/cnbs/cnbstest/.springBeans
    modified:   hybris/config/.project
    modified:   hybris/config/tomcat/conf/catalina.properties
    modified:   hybris/config/tomcat/conf/server.xml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    hybris/bin/custom/cnbs/cnbsbackoffice/.classpath.bak

Я перепробовал все, что мог придумать, чтобы исключить файлы .springBeans и .project, но они этого не делают. Любые предложения о том, как их исключить ???

Вот весь мой файл gitignore:

# Folders to ignore at root(hybris)
hybris-sbg
installer
build-tools
c4c-integration

# Folders to ignore, whatever the place they are
.metadata
classes
hybris/bin/**/bin
gensrc

# Folders to ignore at the root of the repository
hybris/log/
hybris/temp/
hybris/data/
licenses/
hybris/hybris/sampleconfigurations/


# filter only custom extension
hybris/bin/*
!hybris/bin/custom/

# Absolute path to ignore
hybris/config/local.properties

# Filename patterns to ignore
*.class
build.xml
Generated*.java
platformhome.properties
*testclasses.xml
extensioninfo.xsd
*hmc.jar
hmc.xsd
items.xsd
beans.xsd
ruleset.xml
*.log
base.properties
SIGNATURE.SMF
package-lock.json
.DS_Store
.classpath
.project
*.swp

#  Addon specific copy folders
**/_ui/addons
**/views/addons
**/tld/addons
**/tags/addons
**/messages/addons
*_bof.jar
**/.project
**/.springBeans
...