Upgrade Laravel

If you want to upgrade Laravel to the latest you can use Laravelshift which is really cool. But you can do this manually with git as well. In this example we are going to use git rebase.

Upstream

We start by adding another repository to our git configuration and we call it upstream:

git remote add upstream git@github.com:laravel/laravel.git

Then get the latest from that added repository using

git fetch upstream

You will then see a very long list of additions

➜  laravel-k8 git:(master) git fetch upstream
 warning: no common commits
 remote: Enumerating objects: 5, done.
 remote: Counting objects: 100% (5/5), done.
 remote: Compressing objects: 100% (5/5), done.
 remote: Total 31180 (delta 0), reused 2 (delta 0), pack-reused 31175
 Receiving objects: 100% (31180/31180), 9.70 MiB | 1.27 MiB/s, done.
 Resolving deltas: 100% (18457/18457), done.
 From github.com:laravel/laravel
 [new branch]        3.0        -> upstream/3.0
 [new branch]        5.0        -> upstream/5.0
 [new branch]        5.1        -> upstream/5.1
 [new branch]        5.2        -> upstream/5.2
 [new branch]        5.3        -> upstream/5.3
 [new branch]        5.4        -> upstream/5.4
 [new branch]        5.5        -> upstream/5.5
 [new branch]        5.6        -> upstream/5.6
 [new branch]        5.7        -> upstream/5.7
 [new branch]        5.8        -> upstream/5.8
 [new branch]        develop    -> upstream/develop
 [new branch]        master     -> upstream/master
 ....
 [new tag]           v5.8.0        -> v5.8.0
 [new tag]           v5.8.16       -> v5.8.16
 [new tag]           v5.8.17       -> v5.8.17
 [new tag]           v5.8.3        -> v5.8.3
 [new tag]           v5.8.35       -> v5.8.35
 [new tag]           v6.0.0        -> v6.0.0
 [new tag]           v6.0.1        -> v6.0.1
 [new tag]           v6.0.2        -> v6.0.2
 [new tag]           v6.12.0       -> v6.12.0
 [new tag]           v6.2.0        -> v6.2.0
 [new tag]           v6.4.0        -> v6.4.0
 [new tag]           v6.5.2        -> v6.5.2
 [new tag]           v6.8.0        -> v6.8.0 

Rebase & Conflicts

Then you can do a rebase to merge and fix any conflicts there may be

git rebase upstream/master

In general there will be conflicts to deal with. You need to be especially careful with config files, composer.json. package.json.

Upgrade by Tag

Or you pick a version by tag

git rebase upstream/5.6

This allows you to move from version to version. Might be good if you are several versions behind. Mind you that even a small step can be 40+ conflicts to deal with

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.