GitIgnore Directory

.gitignore Directory

Example Directory name : uploads

Ignoring ALL folders and files

 # .gitignore
uploads

Result:

# Will Ignore

/uploads # directory
/uploads # file
/example/path/uploads # directory
/example/path/uploads # file

Ignoring only the Root Directory

The correct syntax for that is to put leading and trailing slash:

 # .gitignore
/uploads/

Result:

 # will ignore
/uploads # directory

# will NOT ignore
/uploads              # file
/some/path/uploads    # directory
/another/path/uploads # file

Ignoring only the Root Directory and the Root File

 # .gitignore
/uploads

Result:

# will ignore

/uploads # directory
/uploads # file

Ignoring only Folders and not Files

# .gitignore
uploads/

Result:

# will ignore:
/uploads # directory
/some/path/uploads # directory

# will NOT ignore:
/another/path/uploads # file

Leave a Reply

Your email address will not be published. Required fields are marked *

*