I am starting a fresh build of an existing non-Laravel project so I've created an orphan branch off my master, removed existing files and installed Laravel.
The problem is that when I switch back to my master branch, the vendor and storage directories (and files) persist in my local master branch, and are showing up as ready to be staged and committed.
I was under the assumption that any files, folders, etc that are created in the new branch, would not exists when switching branches.
The vendor directory is in the .gitignore
in your fresh branch, so those files are not tracked by git. They are not added to the repo, and do not wish to be.
When you switch branches, git is not going to touch any files for which it is not tracking. So, when you switch to master, it will not delete the vendor files, as git is not tracking them.
Now when you're on master, your .gitignore
in master probably does not ignore the vendor directory, so your master branch sees those files as new files ready to be checked in. Add the vendor directory to the .gitignore
in your master branch, and they'll stop pestering you.