Check a Git patch before sharing it
A Git diff shows changes to code, including lines you removed. Those old lines can reveal a password just as easily as new ones. File paths, names and commit messages can also be private. Make a separate copy for someone to read and keep your working patch in the project.
1. Choose the smallest useful change
Copy only the files or change the reader needs. Read added lines, removed lines and the unchanged lines around them. All can contain private information. A short excerpt is often enough to discuss a problem without sending the full repository or its history.
2. Open the copy in Git patch sharing cleaner
Choose a .patch or .diff text file saved as UTF-8, up to 2 MiB and 30,000 lines. It stays in your browser; nothing runs or goes to GitHub. Leave the default replacements on for the first preview. They cover common secret patterns, emails, file headers, home-folder paths, author fields and commit messages.
3. Add private names the tool won't know
Add customer, company, repository or project names under Other terms to replace, with one per line. You can add up to 30 terms, each 2 to 200 characters long. Matching ignores upper and lower case. Use specific terms so the cleaner doesn't remove unrelated code the reader needs.
4. Check every line of the preview
Press Prepare review excerpt and read the preview and replacement counts. Give removed lines the same attention as additions. Look for keys split across lines, encoded passwords, test accounts, private links, comments and filenames. The cleaner leaves out binary patch data, such as image changes; it hasn't checked the contents of those omitted files.
5. Send it as a reading copy
Press Download review excerpt and open the download. Replacements can change file paths and the surrounding code, so the result may no longer work as a patch. Tell the recipient it's for reading. If they need to apply the change, prepare a separate working patch or a made-up code example you can safely share.
6. Deal with any secret already shared
Revoke or replace a leaked password or token at its service. The cleaner doesn't edit commits, rewrite Git history or recall copies you sent. Arrange any repository cleanup with collaborators separately so you don't disrupt their work.
Good to know
Common-pattern checks can miss unusual secrets and identifying details, and they may replace harmless code. A cleaned excerpt doesn't prove the whole repository is clear. You still need permission to share private source code.