A public technical repository needs a slightly different mindset from an internal one.

Before committing, these three commands are useful:

git status
git diff
git diff --cached

git status

Shows which files are:

  • modified
  • new/untracked
  • staged
  • deleted

git diff

Shows changes that have not yet been staged.

git diff --cached

Shows what is currently staged and therefore what the next commit will contain.

That last check is particularly useful before publishing PowerShell or configuration examples.

I am looking for things such as:

  • API tokens
  • tenant or account IDs
  • internal hostnames
  • private URLs
  • email addresses
  • private IP addressing
  • credentials
  • accidental debug output
  • files that were never intended to be public

Git makes publishing easy.

That is exactly why checking the commit before pushing matters.