Ignore Files and Topics

.gitignore, .gitattributes and Repository Topics

BookNest's .gitignore and .gitattributes came from First Repository. A brand-new repository can start from GitHub 29 's own templates with gh 29 repo create --gitignore Node --license mit.

.gitattributes also steers Linguist, the library that computes the language bar on the repository page. It counts programming and markup languages only, so right after the first push the languages API reported just JavaScript (9,822 bytes) and HTML (1,775), and db/schema.sql was invisible. One attribute changes that, and the same listing adds topics, the repository's tags:

Counting SQL in the language statistics, then adding topicsShell
echo '*.sql linguist-detectable' >> .gitattributes
git commit -q -am "Count SQL files in GitHub's language statistics"
git push -q
gh api repos/{owner}/{repo}/languages --jq .
gh repo edit --add-topic nodejs,express,postgresql,rest-api,bookshop
gh repo view --json repositoryTopics --jq '[.repositoryTopics[].name] | join(", ")'
Output
{"HTML":1775,"JavaScript":9822,"SQL":351}
bookshop, express, nodejs, postgresql, rest-api

Linguist recomputes the statistics in the background shortly after a push; linguist-generated and linguist-vendored do the opposite, hiding build output and third-party code. Topics appear under the description (2) and power searches such as topic:rest-api. They are lowercase letters, digits and hyphens, up to 20 per repository; prefer the names GitHub suggests as you type.