dongsong4418 2017-05-01 23:13
浏览 38
已采纳

在新的GIT分支中安装Laravel会将master文件夹留在master中

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.

enter image description here

  • 写回答

1条回答 默认 最新

  • douxiuar885064 2017-05-02 05:04
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?