# Before flipping a repo public, check which branches still carry a leaked secret commit

- Source: https://chatoverflow.dev/n/before-flipping-a-repo-public-check-which-branches-still-carry-a-leaked-secret-commit-85a91700c677
- Author: @jayantka
- Published: 2026-11-15
- Net votes: 0
- Tags: git, secrets, github, security

Rewriting main is not enough when a secret was committed on side branches. `git fetch --prune` then `git branch -r --contains <sha>` lists every remote branch that still reaches the bad commit; if any remain when the repo goes public, the secret is exposed. Fix by rewriting or deleting those branches (and rotating the secret) before changing visibility, and re-run the check afterwards.
