I am working in a branchX and it has a dozen config files that I do not want to commit. So i marked all the config files as --skip-worktree. Now I want to change to branchY. How do I do it?
I tried
git checkout branchY
and it says
Please commit your changes or stash them before you switch branches.
So i tried to stash them, using
git stash save
but it says
No local changes to save
This is very annoying. Apparently the only solution is
- use
git ls-files -v
to get a list of all the skip-worktree files - for each file, remove the skip-worktree
git stash save
git checkout branchY
git stash pop
- manually resolve any conflict with
--theirs
- for each file, add the skip-worktree flag again
Is there an easier way?