0

I am trying to figure out how to modify my .gitignore file to work with this source tree.

The vendor code at one level and custom code in a folder under the custom code folder. Only the custom code needs to be committed, the vendor code needs to be ignored. So this is what I have in my .gitignore file and it works, for the most part:

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

If I understand the two lines, the first say ignore EVERYTHING in hybris/bin, then the second one say, 'except for the custom folder'. There are a few files within the custom folder which need to exclude though: .springBeans and .project. When I do a git status, I am seeing this:

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

I have tried everything I can think of to get .springBeans and .project files to be excluded, but they never are. Any suggestions on how to get them to be excluded???

Here is my whole gitignore file:

# 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
Sam Carleton
  • 1,339
  • 7
  • 23
  • 45
  • 2
    Does this answer your question? [How to make Git "forget" about a file that was tracked but is now in .gitignore?](https://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore) – alfunx Nov 06 '19 at 20:55
  • 1
    I see you have edited your question, but the linked question still applies. Your `.gitignore` is correct, as far as I can tell - the `**/.springBeans` will make Git ignore all of those. However, as you can see in the status, those files (e.g. `hybris/bin/custom/cnbs/cnbscore/.springBeans`) are already tracked, and thus are no longer under the influence of the `.gitignore`. – alfunx Nov 06 '19 at 21:32
  • THANK YOU! I had not made the connection regarding Git already tracking them. It makes sense now, much appreciate your comment here! – Sam Carleton Nov 06 '19 at 21:35

0 Answers0