I have a repository with a Laravel App I'm working on which has master and gh-pages branches.
When I do
git checkout gh-pages
Everything works but two directories 'app' and 'vendor' from the master branch show up. In the gh-pages branch I added them both to .gitignore just to make sure they don't get pushed up to the gh-pages remote branch. But then I decided to try deleting the vendor directory. When I switched back to the master branch the vendor directory was gone so I had to run composer install to get it back.
Then I tried cloning the repository over again, fetching the gh-pages branch and the same problem occurs.
ignoring them in the gh-pages branch works but they don't belong there so I'm confused as to why they are there. These are the only two directories that appear in both branches.
You can see looking at the repo on github https://github.com/isimmons/office-twit that these directories are not there so I don't understand why they are there in my local cloned repo.
UPDATE: Starting with a clean clone of the repo here is a complete listing of the cli output. Something happened that made the /app directory go away in gh-pages branch but the problem is still there with the /vendor directory.
C:\Users\lotus\projects
λ git clone git@github.com:isimmons/office-twit.git
Cloning into 'office-twit'...
remote: Counting objects: 470, done.
remote: Compressing objects: 100% (254/254), done.
rRemote: Total 470 (delta 190), reused 458 (delta 178)
Receiving objects: 100% (470/470), 946.23 KiB | 460.00 KiB/s, done.
Resolving deltas: 100% (190/190), done.
C:\Users\lotus\projects
λ cd office-twit\
C:\Users\lotus\projects\office-twit (master)
λ ls
app bootstrap composer.lock phpunit.xml readme.md upgrade.md
artisan composer.json CONTRIBUTING.md public server.php
C:\Users\lotus\projects\office-twit (master)
λ git remote
origin
C:\Users\lotus\projects\office-twit (master)
λ git branch
* master
Everything is good at this point. Double checked to make sure all I have is 'origin' remote with 'master' branch and the /vendor directory is missing as it should be.
Before pulling in the gh-pages branch I do a 'composer update' which adds the /vendor directory.
C:\Users\lotus\projects\office-twit (master)
λ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing intouch/newrelic (dev-master aca23cc)
Loading from cache
- Installing symfony/translation (2.4.x-dev 0919e0f)
Loading from cache
. . . many more packages install . . .
Generating autoload files
Generating optimized class loader
Listing the contents of the directory I see /vendor as I should at this point, and git status shows a clean directory as it should because /vendor is in the .gitignore file.
C:\Users\lotus\projects\office-twit (master)
λ ls
app bootstrap composer.lock phpunit.xml readme.md upgrade.md
artisan composer.json CONTRIBUTING.md public server.php vendor
C:\Users\lotus\projects\office-twit (master)
λ git status
# On branch master
nothing to commit, working directory clean
Next I checkout and track the gh-pages branch so what I have locally should be identical to what is on the remote (origin).
C:\Users\lotus\projects\office-twit (master)
λ git checkout -b gh-pages origin/gh-pages
Branch gh-pages set up to track remote branch gh-pages from origin.
Switched to a new branch 'gh-pages'
As you can see somehow the /vendor directory shows up in the gh-pages directory though on the remote viewing gh-pages branch at https://github.com/isimmons/office-twit/tree/gh-pages the directory does not exist. So this is happening locally.
C:\Users\lotus\projects\office-twit (gh-pages)
λ ls
assets index.html README.md vendor
C:\Users\lotus\projects\office-twit (gh-pages)
λ git status
# On branch gh-pages
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# vendor/
nothing added to commit but untracked files present (use "git add" to track)
I don't want to push gh-pages at this point because /vendor doesn't belong there and while adding /vendor to .gitignore will keep it from being tracked, it shouldn't be there at all.
If I delete /vendor while in the gh-pages branch, then git status shows a clean working directory but then when I change back to the master branch /vendor has been deleted there too.
C:\Users\lotus\projects\office-twit (gh-pages)
λ rm -rf vendor
C:\Users\lotus\projects\office-twit (gh-pages)
λ git status
# On branch gh-pages
nothing to commit, working directory clean
C:\Users\lotus\projects\office-twit (gh-pages)
λ git checkout master
Switched to branch 'master'
C:\Users\lotus\projects\office-twit (master)
λ ls
app bootstrap composer.lock phpunit.xml readme.md upgrade.md
artisan composer.json CONTRIBUTING.md public server.php
LAST UPDATE: I just figured out why the /app directory was there before. When I have the local repo opened for editing in SublimeText even if the master branch is clean, then change to the gh-pages branch, /app re-appears in that branch. This wasn't happening above because I was strictly using the cli. So the solution to that part of the problem is to completely close the /app directory before switching branches.