Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

S.Peedy's avatar

Best git strategy to keep laravel up to date?

How can I update my laravel project with the latest patches and updates? If I setup a branch "laravel" with the laravel/laravel project and merge it into my master project branch, my git history is not clean anymore. I mean keeping my app up to date with https://github.com/laravel/laravel. After updating this, I run composer update to upgrade the laravel/framework and the dependencies.

I found the solution below but then I would have to do it manually by copying al the changed files from a clean laravel project. I don't think that is best practices. https://laracasts.com/discuss/channels/general-discussion/development-in-laravel-5-best-practices

How do you guys manage this?

0 likes
1 reply
mikeferry's avatar

Here's what I do:

Add Laravel's official repo as a remote.

git remote add -f laravel https://github.com/laravel/laravel.git

View the files that are different between your project branch and the latest stable Laravel release within the release branch you're using for your project. The first column in the resulting list is a letter representing the change status of the file. A = Add, D = Delete, M = Modify, etc. Run git help diff and search for --diff-filter to see all possible statuses.

git diff --name-status <local branch> laravel/5.3

Check out the files from the laravel remote that have been added/modified/renamed, etc.

git checkout laravel/5.3 <file path>

Delete any files that have been removed from the laravel remote.

git rm <file path>

Update Composer packages

composer update

Update Node packages

npm update

Commit all of the changes

git add .
git commit -m "Update Laravel to 5.3.31'

Please or to participate in this conversation.