Commits with the guard
The NEW: filename.ext (the guard reads it)
- Every commit needs one. Nothing new: -m "NEW: none"
- Name each NEW file the commit adds under brains/. The file name is enough, no path needed, any separator: -m "NEW: items-cache.js, foo.css"
- New files outside brains/ (like _ADMIN docs) don't have to be named, but naming them is fine.
Splitting a long command over lines End each line except the last with \ and NOTHING after it, not even a space. Or keep it all on one line.
If the guard refuses: Read the reason.
"'X' was deleted (tools/retired.txt)" means the NAME X is retired and is back in a file you're committing.
retired.txt itself is fine. Usually it means something got staged that you didn't mean to commit.
- NUCLEAR ONLY OPTION: ACCID_GUARD=off
ACCID_GUARD=off git commit -m "what it does" -m "NEW: none"only use if the guard itself is wrong (most likely is not)
Basic Everyday
Don't use "git add ." (or git add -A) It stages every changed file in the folder you're in and below. From the repo root that's every change in the repo, including Codey's half-finished work and stray edits. /path/name.
The everyday habit
git status # see what's changed git add <the files you mean> # by name, or a folder: git add _ADMIN/prompts/ git diff --cached --stat # check what's actually going in git commit -m "what this commit does" -m "NEW: none" # commit of what you stage and why + guard NEW: check w/ no new files in brains.
A) If you only staged (added) what you mean, a plain git commit w/ the guard NEW: list is safe
but NO new files in brains you still have to declare that -m "NEW: none" NEW: ? is alwasy required.
If files are added in the "brains" folder those MUST to be listed or the guard will not allow the commit. Other new file names are not required but can be listed – you only need filenames, paths are not reiqured for NEW: .
git status # see what's changed
git add <only the files/folders you mean> # by path/name, or a folder: git add _ADMIN/prompts/
git diff --cached --stat # check what's actually going in you should only see the stuff you just added
git commit -m "what this commit does" -m "NEW: newfileinbrains.ext, newfile2fileinbrains.ext, newfilenotinbrains.ext" (new files in brains are required in brains - new files outside of brains are not required but are ok to add)
You do NOT have to list the paths to each file for NEW: only the filename works AND you can list filenames out side of brains if you choose to (keeps the log up to date).
B) AVOID THIS!! When other things are staged (added) that you DON'T want in this commit
you have to tell it what you WANT committed (by path/filename) so those files are commited and the rest is left only staged
git status # see what's changed
git add . # you added ALL changes but don't want to send all of them so you need to tell it which ones in the commit
- OR -
there is other stuff staged that isn't yours and you don't know what is on with it you see that here:
git diff --cached --stat # check what's actually going in - other staged pieces? - don't commit it
git commit -m "what this commit does" -m "NEW: newfileinbrains.ext, newfile2fileinbrains.ext" -- path/newfileinbrains.ext path/newfile2fileinbrains.ext path/updatedfilethatwaschangedbutisnotnew.ext (show paths to the files you WANT to commit - new and updated both)
— means "commit only these paths".
- List new and updated files by path/filname.ext with spaces, no commas.
- Paths are relative to the folder you're in (run from /var/www/starter).
A brand-new file must be git add-ed first. Everything else stays staged for later.
git add path/newfileinbrains.md path/newfile2fileinbrains path/updatedfilethatwaschangedbutisnotnew.md (also can add entire folder)
git commit -m "what this commit does" -m "NEW: newfileinbrains.ext, newfile2fileinbrains.ext" -- path/newfileinbrains.ext path/newfile2fileinbrains.ext path/updatedfilethatwaschangedbutisnotnew.ext (show paths to the files you WANT to commit - new and updated both)
retired.txt
etired.txt lists names, not files. Each line is a pattern (a function, a global, a file name or a CSS prefix) with a status:
| Status | Meaning | What the guard does |
|---|---|---|
gone | deleted, must never come back | name found in code β commit refused |
kill | retired by ruling, still in the code, waiting to be deleted | reported on every run, never refuses |
The guardβs output labels:
- BACK: a
gonename is in code again. Refused. - note: a
gonename appears only in comments (stale comments). Reported, fine. - LIVE: a
killname is still in code. Expected, e.g. AccidStylePanel 29. - DONE: a
killname has 0 code lines left. Flip it togonein the same commit that deleted it. From then on it canβt come back unnoticed.
Rules from the file itself: never delete a line, and comment lines donβt count as code. It doesnβt scan _JUNK, the old seeds, aug27test-accid, upload-to-live, vendor, *.min.js or *.md.
When the old-panel cleanup lands, those six kill lines (AccidStylePanel, accid-style-panel, BottomBarPanel, β¦) show DONE and become gone.
A correction to what I told you earlier. Reading the guardβs code, your refused commit probably did not have those four code files staged. Look at the first line of its output:
retired check β whole tree under brains/ (CI mode)
The guard falls into βCI modeβ (scanning the whole tree) only when nothing is staged. With files staged, it would have said βN staged file(s) under brains/β or βtouches no code under brains/β. So when you first ran git commit, nothing was staged. Your archive file hadnβt been added yet. The guard then scanned the whole tree, found the three names that really are back somewhere in the repo, and refused with βit is in a file this commit changesβ. That last part was untrue. When you added the file and committed again, it said βtouches no code under brains/β, which fits.
So you did nothing wrong. This is a guard bug: an empty commit on the box gets the whole-tree CI scan and blames old problems on your commit. The fix for Codey, small and in its own commit:
- In the pre-commit hook: nothing staged β say βnothing stagedβ and stop. Never CI mode.
- CI mode only when CI asks for it (an explicit flag or environment variable), not βbecause nothing is stagedβ.
- Reword the refusal: βthe retired name βXβ is in
β β and only add βa file this commit changesβ when thatβs true.
The cheat sheetβs advice to stage by name still stands; itβs just not what caused this one.