4 ms·
On repos with more than one user, it's better to have a local .gitignore.
by silverwind 4y ago
On repos with more than one user, it's better to have a local .gitignore.
- fullstop 4y agoYour colleagues also love to push generated files and binaries? It's a constant struggle over here.
- fragmede 4y agotime for a pre-commit hook
- jsmith45 4y agoRight. If working with other people, a global gitignore is probably most sensible if you you have say an uncommon editor that likes to create a subfolder with metadata, or has a weird convention on temporary in-place rename file names. In those sort of situations, adding the paths from your weird setup to every .gitignore file you work with might be overkill, and potentially unwelcome by maintainers of some projects you work on. But for more common stuff like visual studio cruft in a windows C++ or .NET project, or the python cache folders in a python project, etc., it probably makes more sense to have that stuff in the repository level .gitignore.
- wlonkly 4y agoOr even if you have a common editor! Having to add several editors' worth of excludes to .gitignore on every project is annoying. Much easier if everyone takes care of their own local droppings, and the committed .gitignore can focus on project-specific ignores.
- smcleod 4y agoYou can have both, in repo gitignore and your global one.
- jwilk 4y agoThere's also .git/info/exclude: > Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a .gitignore file. > Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow) should go into the $GIT_DIR/info/exclude file. > Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice) generally go into a file specified by core.excludesFile in the user’s ~/.gitconfig. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead. https://git-scm.com/docs/gitignore https://git-scm.com/docs/gitignore