Could Not Find Remote Ref
Error message
fatal: could not find a ref that matches upstream/feature
Quick summary
You referenced a remote branch that does not exist — it may not have been pushed yet or was deleted.
Why this happens
The branch was never pushed to the remote
The branch was deleted on the remote
You have not fetched recently and your remote-tracking refs are stale
Typo in the branch or remote name
Minimal example
git checkout origin/feature # fatal: could not find a ref that matches origin/featuregit fetch origin
git branch -r # verify the branch exists
git checkout origin/feature # now works if it existsFetch to update remote-tracking refs, then verify the branch exists with git branch -r before checking out.
How to diagnose
Run git fetch --all to update all remote-tracking refs
Run git branch -r to list all remote-tracking branches
Verify the remote and branch names are correct
How to fix
Fetch first: git fetch origin, then retry
If the branch does not exist on the remote, push it: git push -u origin <branch>
Fix typos in the remote or branch name
If the branch was deleted, create it again or use a different branch
How to prevent
Run git fetch before referencing remote branches
Use git branch -r to verify remote branches exist