So I was working in a branch and decided to remove my docs directory from the repo using git rm -r --cached docs. This all went well. Committed, working directory clean, all good. Now when I try to git checkout master so that I can merge this branch back into master I get the following error:
error: Untracked working tree file 'docs/bin/.htaccess' would be overwritten by merge.
Is there anything I can do now to get back to my master branch? Do I need to put the docs directory back into the repo, then switch branches, and then remove it on master?
Note that
git rm --cachedremoves files from the index only. Why didn’t you want to delete them from the filesystem too?gitis trying its best to stop you from losing work. Assuming the files indocsare safely committed in another branch, useFrom the
git checkoutdocumentation: