How to check if a Git repo is fully synced with a remote

2 July 2025

Recently I was clearing out my files and I wanted to delete some Git repos that I didn’t need locally any more, i.e., those which are fully synced to a remote repo. While looking through them, I was reminded how many places there are for local changes to hide in a repo, so I wrote a quick script:

https://github.com/tmewett/my-config/blob/main/bin/git-is-synced

Here’s an example:

tom@phoenix ~/P/BrogueCE> git-is-synced
There are stash entries.
Branch 'brogue-speak-v03-local' does not have an upstream configured.
Branch 'consistent-seize-checks' does not have an upstream configured.
Branch 'feature/audio' has unpushed commits.
Branch 'fix-exit-logic' has unpushed commits.
Branch 'from-cppcheck' does not have an upstream configured.
Branch 'msys2-action' does not have an upstream configured.
Branch 'update-gh-actions' does not have an upstream configured.
Branch 'v1.7.4' does not have an upstream configured.

The script checks:

  • the working tree is clean
  • there are no stashes
  • all branches have upstreams
  • no branch has unpushed commits

There’s probably more places, but this covered my usage. I hope it’s useful!