It’s been a while since my first post about Laravel, I’ve learnt a lot recently (mostly from Laracasts and Dayle Rees) but yesterday stumbled on a real problem with how the project was setup, so thought I’d cover here what I did to fix it.
Laravel consists of two parts:
When you do a composer install of laravel/laravel you get the current copy of the files, and the laravel/framework becomes a dependency managed by composer.
Laravel is in pretty active development and Laravel 5 particularly isn’t released yet, so there are regular changes to things.
What I encountered yesterday was a situation where both parts of Laravel were updated, in fact some code moved from laravel/framework to laravel/laravel, running the composer update meant that the framework got updated but everything was broken because I didn’t have the necessary changes in laravel/laravel.
I did a LOT of reading and these two posts were of the most interest:
I quite fancied doing this as a rebase, but when I tried to do it I got into a real mess with merges and couldn’t make it work, so I went down this route:
- Cloned the laravel/laravel develop branch (now known as laravel5-fresh).
- Did a git pull to make sure I’d got the latest versions
- Started a new feature with git flow in Sourcetree
- Copied all the files from my laravel5-fresh over the top of my working project directory.
- Ran composer update in my working project directory.
- Looked at the working copy of my project in Sourcetree
- Where it was laravel/laravel code I committed the change.
- Where my code had been wiped out by the copy I discarded it.
- Finished up my feature in git flow.
This isn’t the cleanest way, I’d be happier if it was a merge or a rebase done properly but this feels like it works and allows me to see exactly which laravel changes were in that update.