I had this case with an edge where I checked the previous version of the code in which the structure of my directory was changed:
git checkout 1.87.1 warning: unable to unlink web/sites/default/default.settings.php: Permission denied ... other warnings ... Note: checking out '1.87.1'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new-branch-name> HEAD is now at 50a7153d7... Merge branch 'hotfix/1.87.1'
In this case, you may need to use --force (when you know that reverting to the original branch and reverting the changes is a safe thing).
git checkout master did not work:
$ git checkout master error: The following untracked working tree files would be overwritten by checkout: web/sites/default/default.settings.php ... other files ...
git checkout master --force (or git checkout master -f ) worked:
git checkout master -f Previous HEAD position was 50a7153d7... Merge branch 'hotfix/1.87.1' Switched to branch 'master' Your branch is up-to-date with 'origin/master'.
mcaleaa Apr 10 '17 at 9:41 on 2017-04-10 09:41
source share