![]() It seems that everything is back to normal, but after a closer look, all submodule directories are either empty or incomplete. To avoid tumbling down the rabbit hole deeper and deeper, let’s switch back to the develop branch. Nothing added to commit but untracked files present (use "git add" to track) We check the status again, just to find an untracked image directory: # git status Git displays a warning that it couldn’t remove our akismet directory, which doesn’t make any sense, because it also exists on the master branch, just not as a submodule. Your branch is up-to-date with 'origin/master'. Warning: unable to rmdir wp-content/plugins/akismet: Directory not emptyĬhecking out files: 100% (1993/1993), done. Since we can’t checkout the master branch the regular way, we’ll force it: # git checkout master -f Nothing to commit, working directory clean Checkout master branch Your branch is up-to-date with 'origin/develop'. If there were truly untracked files, running a git status would reveal them, but there aren’t any: # git status You removed the wp-content/plugins/akismet directoryĪt this point, we’re on the develop branch and trying to checkout the master branch, but we’re greeted with this error: # git checkout masterĮrror: The following untracked working tree files would be overwritten by checkout:įor some reason, Git doesn’t recognize that those files have already been added and committed within the akismet submodule, so it’s aborting the checkout to prevent them from being overwritten.Let me setup the problem for you, in detail, using an example: That said, let’s look at the problem in detail and how we can solve it. Git complains with the following error: error: The following untracked working tree files would be overwritten by checkout The main problem is that I’m unable to checkout the master branch after adding the submodules on the develop branch. Luckily, it’s nothing severe, and in my case, pretty straight forward to fix (once you know the solution), but because the error didn’t make any sense, I’ve decided to document it here. While many recommend staying away from submodules all together, I’ve been using them for a while now and never had any issues, that is, until today. Part of each site’s update includes converting the WordPress core and all frequently used plugins to Git submodules. I’m working on updating several WordPress sites. ![]() 6 min read Do birds experience errors when they switch branches?.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |