2013-05-01 22 views
10

ich dir Struktur wie dieses:Erlauben Sie nur einige Dateien in Unterordner mit .gitignore

static 
    admin 
    ajax_upload 
    books 
    css 
    font 
    media 
    robots.txt 
templates 
src 
build 
lib 

Ich möchte ignorieren folgende direcotories:

  • lib
  • build
  • src
  • statisch

Ich möchte erlauben folgende:

  • statisch/css/Bootstrap-styled.css
  • statisch/css/main.css
  • statisch/css/font - * CSS.
  • statisch/font
  • statisch/media/default.png
  • statisch/robots.txt
  • Vorlagen

So verwende ich die folgenden .gitignore:

# Ignore 
/lib 
/src 
/build 
/static/* 

# Allow 
!/static/css/bootstrap-styled.css 
!/static/css/main.css 
!/static/css/font-*.css 
!/static/font 
!/static/media/default.png 
!/static/robots.txt 

Aber es nicht richtig funktioniert. Kannst du mir helfen? Was mache ich hier falsch? TIA!

Einzelheiten

Echtprojektstruktur ist wie folgt:

static 
    admin 
     css 
     img 
     js 
      admin 
    ajax_upload 
    books 
    css 
    font 
    media 
     uploads 
      blog 
      gallery 
     default.png 
    robots.txt 
templates 
src 
build 
lib 

Antwort

16

Also, die .gitignore funktioniert für mich ist die folgende:

# Ignore 
lib/ 
src/ 
build/ 
static/**/* 

# Allow 
!static/css/bootstrap-styled.css 
!static/css/main.css 
!static/css/font-*.css 
!static/font/* 
!static/media/default.png 
!static/robots.txt 
2

Versuchen Sie Folgendes:

# Ignore 
/lib/ 
/src/ 
/build/ 
/static/ 

# Allow 
!/static/css/bootstrap-styled.css 
!/static/css/main.css 
!/static/css/font-*.css 
!/static/font 
!/static/media/default.png 
!/static/robots.txt 

Ich denke, dass sollte funktionieren.

+0

nach 'git add statisch /' oder 'git add static' Ich sehe' Die folgenden Pfade von einem Ihrer .gitignore Dateien ignoriert werden : statisch Verwenden Sie -f, wenn Sie sie wirklich hinzufügen möchten. fatal: keine Dateien hinzugefügt – dizpers

Verwandte Themen