sarah w
sarah w

Reputation: 3475

how to ignore a directory and its sub-directories in gitignore

I want to ignore public folder and its inside folders and file in git

public/app
public/dist/file.html
public/dist/bower_components/
public/dist/fonts/
public/dist/scripts/

i want to ignore all of them and their inside files i followed this link Add newly created specific folder to .gitignore in Git

I am doing it like this in .gitignore file

public/app/*
public/dist//*
public/dist/bower_components/*
public/dist/fonts/*
public/dist/scripts/

but its not working ,i can stil see these files on git status

Upvotes: 1

Views: 586

Answers (2)

phd
phd

Reputation: 94397

Ignore /public/ (leading and trailing slashes, no asterisk).

Upvotes: 1

Tisp
Tisp

Reputation: 436

First verify git status if you have already add this folders. If you was add, try to remove them git rm -r --cached directory.

Next put only public/* in .gitignore to ignore all file in public's folder.

Upvotes: 0

Related Questions