SecretSleuth Talk to IronTech

DocsCommand reference

stage

Commit your edits to a protected file. Your changed lines go to the index; every other line comes from HEAD, and the working copy stays sealed.

Try it

SecretSleuth stage --file appsettings.json
git diff --cached
git commit -m "Add feature flag"

Use stage --all for every protected file holding edits of your own.

How it works

A protected file is skip-worktree, so git add refuses it. stage builds the commit copy and writes it straight to the index: your edited lines, with every other line as committed in HEAD. The file on disk is not modified and stays protected.

On disksealed, plus your edit

"FeatureFlags": { "NewInvoices": true },
"SendGrid": {
  "ApiKey": "DO_NOT_COMMIT_APIKEY"
}

Stagedyour line + HEAD

"FeatureFlags": { "NewInvoices": true },
"SendGrid": {
  "ApiKey": "SG.f3Kq9vXbT2…"
}

The staged copy carries the value already in HEAD. Nothing new is exposed, but it stays in the branch until remediated.

It refuses a file when:

  • an edited line still holds a placeholder. There is no committed value to put back on that line. Replace the placeholder with a safe value ('', an env var name, a Key Vault reference), or undo the change.
  • an edited line looks like a new secret, whether you or an AI assistant wrote it. Move it to user secrets or a vault and commit a reference.

When an edit replaces a placeholder with a safe value or runtime reference, that is a remediation: use stage to put the remediated content in the index, review it, then commit. The pre-commit hook passes when no placeholder is staged.

Options

FlagDescription
--file <path>A protected file to stage (repeatable)
--allEvery protected file holding edits of your own
--repo <path>Repository. Default: current folder

Check the result

git diff --cached should show only the lines you changed.