michi.wtr
Goto Top

gitignore - Alles außer speziellen Ordner ignorieren

Hey zusammen,

wie genau schreibe ich eine .gitignore Datei, um alles in meinem Workingspace zu ignorieren, außer 3 bestimmte Ordner und 2 Dateien....

Folgender Workingspace:


Hier möchte ich auch alles übernehmen. Alle anderen Dateien und Ordner möchte ich aber ignorieren. Deshalb komme ich auf folgende .gitignore Datei:
# Ignore everything
*

# Except for the following directories and their contents
!/Kundenvorlage/**
!/Makro/**
!/Report/**
!.README.md
!.gitignore

Problem (ich habe neue Dateien in den Ordnern erstellt, und 2 der 3 Ordner existieren im Repository noch garnicht):
git status
On branch main
Your branch is up to date with 'origin/main'.  

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

nothing added to commit but untracked files present (use "git add" to track)  


Wenn ich die .gitignore Datei entferne:
git status
On branch main
Your branch is up to date with 'origin/main'.  

Untracked files:
  (use "git add <file>..." to include in what will be committed)  
        Kundenvorlage/Test.txt
        Makro/
        Report/

nothing added to commit but untracked files present (use "git add" to track)  

Content-Key: 3812098184

Url: https://administrator.de/contentid/3812098184

Printed on: April 27, 2024 at 19:04 o'clock

Member: Epixc0re
Solution Epixc0re Feb 28, 2024 at 13:28:28 (UTC)
Goto Top
Servus,

siehe hier

LG
Member: michi.wtr
michi.wtr Feb 28, 2024 at 14:02:39 (UTC)
Goto Top
Perfekt

Quote from @Epixc0re:
siehe hier

War tatsächlich der Fehler, bin ich nicht drauf gekommen

# Ignore everything
*

# Except for the following directories and their contents
!Kundenvorlage/
!Kundenvorlage/**
!Makro/
!Makro/**
!Report/
!Report/**
!.README.md
!.gitignore

Man muss die Ordner selbst auch zuerst wieder hinzufügen.....