toptal / gitignore.io

Create useful .gitignore files for your project

Home Page:https://www.toptal.com/developers/gitignore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: Sort '!' to the bottom of the gitignore file, so inclusions are more important than exclusions

constant-flow opened this issue · comments

Issue

The unity and visual studio templates conflict with each other in the sense that unity relies heavily on *.meta files when versioned and VS is excluding these files. Both solutions are used alongside very often, so they should be matched to work together.

You say now: This sounds like a template issue, you are right, but I'd propose an improvement to this tool.

For example:
This tool could check if the one is having a !*.meta where the other is having a *.meta (unfortunately unity's template doesn't use this notation yet)

Expected Behavior:

Either

  • Give info where the templates conflict, give users a chance to select which rule is active or inactive.
    e.g. track *.meta or ignore *.meta
  • OR (even better solution) automatically see the ! listed items as more important as the exclusion, so basically sorting all the sections (all items listed under a # section) containing ! items to the bottom of the generated file (order in .gitignore matters)

so for example, this whole section should go to the end of the generated gitignore file

# Unity3D generated meta files (include & exclude)
!*.meta
*.pidb.meta
*.pdb.meta
*.mdb.meta

Actual Behavior:

  • stapling files together, order in list will define who wins the fight over inclusion or exclusion

Reproduction Steps:

  • generate a file with unity and visualstudio together --> will exclude *.meta files
  • even if unity would include a !*.meta file, the order would decide which on wins (inc/exc)