You created a file that the other branch also commits
CommonA config file, script or README made locally, while someone else committed a file at the same path.
Confirm
git status --short -- FILE git show BRANCH:FILE | diff - FILE
?? next to the file, then any differences from the branch's copy
Fix
- Keep yours to compare later: mv FILE FILE.mine, switch or pull, then merge anything you need by hand.
- Or stash it with the untracked flag: git stash push -u, switch, then git stash pop when back on your branch.
- If the diff is empty or you do not need it, delete the file and switch.
git stash push -u -m before-switch git switch BRANCH
Reproduced on Git 2.50.1: the switch then succeeded and the stash kept the local file.