Git Ignore vs Git Exclude Notes

Source

These are my notes from reading very nice blog post Git Ignore vs Git Exclude.

Note methodology

I’ve used Jeffrey Kaplan’s methodology for notes.

Notes

  • git exclude isn’t widely recognized as git ignore
  • Articles covers when and how to use git exclude
  • This article is about git exclude one of the two similar functions: ignore and exclude
  • To simplify this article, author is going to skip the git prefix and use ignore and exclude
  • Article is about git exclude and how it is related to git ignore
  • The goal of these two functions is similar, they even share the same help page
  • Commands have the same interface and similar function but they are not the same
  • Two differences, file location and list of tracking files
  • As these two functions are very similar and track information about ignored file, for git they provide different approach of keeping it persistent
  • git exclude helps keeping the ignored files for given location, it’s not ment to be shared, git ignore is a way to persist ignored files for every git repository instance.
  • We can tell git to don’t track some files using two functions: ignore and exclude, usage depentes on the result, public or private exclusion
  • We can use global ignore files to exclude files in all repositories
  • We have, in total, three ways to exclude files: repository’s ignore, repository’s exclude and global ignore
  • When I only want to hide file for myself - exclude, for everyone - ignore, ignored in many repositories on one machine - global ignore