Git – Ignore some folders and files in the current working copy

We can always use the .gitignore to exclude files which we do not want to check in into the repository. But sometimes the repository is only read only and you dun want your files to be appeared in the git status command. A simple solution to exclude those files in your current working copy. This could be done by editing the .git/info/exclude. Here is an example for my Drupal 8 installation.


# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~



Now your working copy should be clean.

Done =)

Reference: StackOverflow – Is there an ignore command for git like there is for svn?


2 thoughts on “Git – Ignore some folders and files in the current working copy”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.