paste this link into your ai. it will know what to do.
Rules for committing, branching and pushing safely as a coding agent. Use before any git commit, push, merge, rebase or history rewrite, and when the user asks to "ship", "commit" or "push" changes.
kindskill
last tended2026-12-05
written byOpenCognitOS
kept currentwith its source · last read 2026-12-05
in the folderopencognitos skills · 6 of 11 · ‹ release notes · sober copy ›
brought here bykt
yours?it stays under your name. to change it or take it down, write to connect@innernet.live
reading2 min
Safe git
Git mistakes made by agents are expensive: lost work, leaked secrets, broken main branches. Follow these rules for every git operation.
Before you commit
- Run
git statusandgit diff --staged. Read what you are about to commit. - Stage files by name (
git add path/to/file). Avoidgit add -Aandgit add .unless you checked every untracked file. - Never commit: -
.env,.env.*(except.env.example),*.pem,*.key,id_rsa*,credentials.json,*.p12, service-account files - local settings such as.claude/settings.local.json,.vscode/with personal paths - build output,node_modules/, large binaries, database files - Scan the staged diff for secrets: API keys (
sk-,ghp_,AKIA,xox), private key headers, passwords in URLs, tokens in config. If you find one, unstage the file and tell the user. Do not "fix" it by committing a removal: the secret stays in history. - Run the project's tests, linter and type check if they exist and are fast. Do not commit red builds without telling the user.
Commit messages
- One commit per logical change. Do not mix a refactor with a bug fix.
- Subject line: imperative, at most ~72 characters, says what changes ("Fix token refresh on expired sessions").
- Body (optional): why the change was needed and anything a reviewer must know.
- Follow the repository's existing style and language (
git log --oneline -20).
Branches
- Never commit directly to
main/masterunless the user asked for it. Create a branch:git switch -c feature/<short-name>orfix/<short-name>. - Keep branches small and short-lived.
Pushing and rewriting history
- Push only when the user asked for it.
- Never use
git push --forceon shared branches. If a rewrite is really needed on your own branch, usegit push --force-with-leaseand say so. - Never run
git reset --hard,git clean -fd,git checkout -- .orgit stash dropwithout explicit permission: they destroy uncommitted work, possibly the user's. - Never rewrite history that is already on the remote (
rebase,commit --amend,filter-branch) without asking. - Do not skip hooks (
--no-verify) to get a commit through. Fix the cause or report it.
When something goes wrong
- Merge conflict: resolve only the conflicting hunks, keep both sides' intent, run tests, and tell the user which files you resolved.
- Wrong commit on main (not pushed): create a branch at the current commit, then ask before moving
mainback. - Pushed a secret: stop, tell the user immediately. The key must be revoked; deleting it from history is not enough.
keep it where your ai can reach it.
innernet is memory your ai tools read live — every skill, every project, every decision, in one place, connected once. save this skill to yours, or publish one of your own as a link like this.