Real Diagnostics, Not Guesswork
git branch -vv
git log feature/recipe-search --not --remotes --oneline
A branch with real commits shown here has never been pushed — genuinely safe to rebase. A branch with an [origin/...] tracking marker already has a real, shared copy elsewhere.
Master Is Never Safe
git log master --not --remotes --oneline
Empty output on master means exactly what it should: every real commit here is already shared. Master is never a real candidate for rebasing.
Writing the Real Policy
git switch -c docs/rebasing-policy
# write REBASING.md
git commit -m "Document the team's rebasing policy"
git push -u origin docs/rebasing-policy
A real, permanent, committed document — not a Slack message that gets lost, not a rule everyone half-remembers differently.
Every rebase technique this block has covered — squash, split, reorder, reword — genuinely rewrites history. That is completely safe on a real branch nobody else has seen. It is a real, genuine hazard the instant anyone else has pulled it.
This lesson is not about a new command — it is about real, professional judgment. git log <branch> --not --remotes reveals exactly which real commits on a branch exist ONLY locally, never yet shared. Combined with git branch -vv, this becomes a genuine, reliable way to answer "is this actually safe to rebase?" before ever running the command.
git log <branch> --not --remotes
Lists exactly the real commits on a branch that exist ONLY locally — nowhere on any remote. Confirmed directly in this lab: empty output on master proved every real commit there is already shared; real output on a feature branch proved it never has been.
A written team policy as a real, committed document
A rule that only lives in memory or chat history is not really a team policy — confirmed directly in this lab by writing it into the actual repository as REBASING.md, reviewed and merged exactly like any other real change.
Takeaways
- git log <branch> --not --remotes reveals exactly which real commits exist only locally, never shared
- master (and any branch with real pushed/pulled commits) is never a candidate for rebasing
- A branch with an open PR under active review is a real, special case: rewriting it disrupts the reviewer, even without a teammate's local copy
- A rule that only lives in memory or chat is not a real policy — writing it into the repository itself makes it durable