To safely check if a local git repository is fully backed up to its remotes and safe to delete, you want to ensure there are no uncommitted changes, unpushed branches, stashes, or unpushed tags.
Here are the commands you can use to check your repository's state:
1. Ensure working directory is clean
This checks that you don't have any uncommitted edits, untracked files, or staged changes.
git statusYou should see: nothing to commit, working tree clean
2. Check for any stashed changes
If you've used git stash to save unfinished work, those changes are only stored locally.
git stash listIf this returns nothing, your stash is empty.
3. Check for unpushed branches and commits
First, fetch the latest from all remotes so your local repo knows the remote state:
git fetch --allThen, compare your local branches to the remotes. This command will list any commits on any local branch that haven't been pushed to a remote yet:
git log --branches --not --remotes --onelineIf this outputs nothing, it means every commit on every local branch is already present on a remote.
4. Check for unpushed tags (optional)
If you use Git tags, verify that they've been pushed to your remote:
git push --tags --dry-runIf it says Everything up-to-date, your tags are pushed.