Here a quick blog post how to update Trellis like a pro.
Here are some requirements or basically tips before you get started
- Trellis should be in its own repo not together with Bedrock/Site
- Always make sure you’re working in a Git repo
- Make sure all your work is committed
- Use a great IDE like Visual Code to deal with merge conlficts
Trellis As Upstream Remote
Add Trellis as a remote
git remote add upstream email@example.com:roots/trellis.git
The pull the upstream changes using
git fetch upstream
You will then see something like
git fetch upstream remote: Counting objects: 40, done. remote: Compressing objects: 100% (6/6), done. remote: Total 40 (delta 24), reused 29 (delta 24), pack-reused 9 Unpacking objects: 100% (40/40), done. From github.com:roots/trellis c8515b3..14cce04 master -> upstream/master * [new branch] memcached-disable-udp -> upstream/memcached-disable-udp
Once that is done rebase upstream changes into your master repository using
git rebase upstream/master
Git Merge Conflicts
Manually fix all conflicts. I recommend Visual Code as it visually helps you to deal with it all as you see in the image below. Also read: https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase/46 and http://tedfelix.com/software/git-conflict-resolution.html26
In Visual Studio Code you simply need to accept current change (added by upstream) or keep incoming change. And the latter you have to do for most if not all group_vars files.
Once you have fixed all conflicts you can do a
git add . git rebase --continue
Merge Conflicts Leftovers
When I continued the rebasing I got a few more merge conflicts:
Falling back to patching base and 3-way merge... Auto-merging group_vars/development/vault.yml CONFLICT (content): Merge conflict in group_vars/development/vault.yml Auto-merging Vagrantfile Auto-merging README.md Auto-merging CHANGELOG.md CONFLICT (content): Merge conflict in CHANGELOG.md error: Failed to merge in the changes. Patch failed at 0002 first commit The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git rebase --continue". If you prefer to skip this patch, run "git rebase --skip" instead. To check out the original branch and stop rebasing, run "git rebase --abort".
So I fixed the files and overwrote changelog, README and Vagrantfile with the latest from the repo at Github. Then I rebased again and… all good!
NB This blog post is based on Swalkinshaw’s post at Roots Discourse on updating Sage
Hi, trying to do this. When I run git rebase upstream/master, I get:
error: Failed to merge in the changes.
Patch failed at 0008 add whitelisted plugins
It doesn’t seem to like my commit…
I’m very beginner level of git, so I’m struggling to do this.
Also, does it matter where I run these git commands? I’m doing it from within the trellis folder.
Appreciate your help!
Well, did you check the file it complained about during the merger? As you can see in this post I had conflicts too. You’ll see <<<<<<, ====== and >>>>>> markers. The conflict is in those lines. See some more details on tracking down conflict areas at https://stackoverflow.com/a/19448916/460885 . With Visual Studio Code I checked these files again (it also indicates where conflicts are by default), fixed them and continued the rebase.