I work on a Laravel project.
When I'm in master branch and I checkout to another branch I get this message :
$ git checkout 34-my-new-branch
error: Your local changes to the following files would be overwritten by checkout:
storage/framework/views/caaf62f72d38b7d25287398a507510f101a5b18e.php
Please commit your changes or stash them before you switch branches.
error: The following untracked working tree files would be overwritten by checkout:
storage/framework/views/057722c519eb01b3d6b8aa1e28f4b226ca8e290e.php
storage/framework/views/cfb3bd21bb7e616852dcb3192ea1826fb247979f.php
Please move or remove them before you switch branches.
Aborting
`
Is there a way to prevent this message?
Top comments (7)
Add a
.gitignore
tostorage/framework
with the following content:Those are compiled views and should never be committed in the first place, so you can safely remove them by then typing
git rm -r --cached storage/framework/*
.Then commit.
my current .gitignore is like :
`
What should I add exactly ?
and then run
git rm -r --cached storage/framework/*
Not wrong. But also not what I said.
In case Mostafa didn’t know, it’s entire possible and legal to have multiple .gitignore files.
Possible, but from my personal experience it is better to have a single
.gitignore
file to rule them all 🙂Please re-read my comment, as I explained exactly what you need to do to fix this.
In case you didn’t know, it’s completely fine to have multiple .gitignore files.
okay Thanks RVxLab