Git Branch Exists on Remote But Won't Show Locally

📰 Dev.to · Ryan Carter

Learn to diagnose and fix git branches that exist on remote but won't show locally, using fetch refspecs and git config

intermediate Published 28 Apr 2026
Action Steps
  1. Check if the branch exists on remote using git ls-remote
  2. Verify the fetch refspec using git config --get remote.origin.fetch
  3. Update the fetch refspec to include all branches using git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
  4. Run git fetch origin --prune to update local branches
  5. Use git branch -r to verify the branch is now listed locally
Who Needs to Know This

Developers and DevOps engineers can benefit from this knowledge to resolve common git issues and improve their workflow

Key Insight

💡 A scoped fetch refspec can prevent git from showing all remote branches locally, but updating the config can resolve the issue

Share This
💡 Fix git branches that exist on remote but won't show locally! Update fetch refspec and run git fetch origin --prune
Read full article → ← Back to Reads