Git Attributes Resolver

Work out the attributes a top-level .gitattributes file gives one path, and which line decides each one.

Attributes file and path

One rule per line. Blank lines and lines starting with # are skipped. [attr]name ... defines a macro; a leading ! resets an attribute to unspecified.

Relative to the .gitattributes file, using / separators. End with / to resolve the directory path itself.

Git decides each attribute independently: the last matching line wins, and later lines override earlier ones per attribute rather than per path. Patterns follow the same rules as .gitignore, except that negative patterns are forbidden here and a directory match does not reach the files inside it, so use dir/** instead of dir/. Only the top-level file is read, not .gitattributes files in subdirectories or $GIT_DIR/info/attributes. Everything runs in this page: no repository access, storage, uploads or network requests.