Skip to content

Ignore a folder only on top level of a repository #23600

Discussion options

You must be logged in to vote

gitignore rules apply only to untracked files. If you want to stop tracking those files, you have to explicitly remove them from the repository. If you want to keep the files on disk (in your working tree) but remove them from the repository you can use git rm --cached.

reburg67:

I created a file .gitignore on top level and wrote /assets/* into this file.

As a side note, /assets/ would be a better rule, it ignores the directory and everything in it. It only makes a difference if you have files starting with names starting with a dot in the directory, though.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants