Chapter Five · Housekeeping

Ignoring and Setting Aside

Three pages of cleanup: the files Git should never see, the awkward sequel when one of them is already committed, and the drawer you put half-finished work in when something urgent arrives.

3 topics

A short chapter about keeping the repository clean, sitting between the two large ones on either side of it.

Three topics. The files Git should never see, and the one plain text file that keeps all of them out. The awkward case where one of those files is already committed, which is not solved by ignoring it and — if the file was a secret — does not start with a Git command at all. And the drawer you put half-finished work into when something urgent interrupts you.

None of this is difficult. All of it is the difference between a repository that stays pleasant to work in and one that quietly accumulates four hundred megabytes of things nobody meant to keep.

Four kinds of file that do not belong in a repository
Secrets
passwords · API keys · .env — the category that costs real money
Generated output
build folders · compiled files — regenerable, so pointless to store
Dependencies
node_modules/ and friends — huge, and reinstallable in one command
Machine noise
.DS_Store · editor folders — clutter that makes status unreadable

Topics in This Chapter