How to update to latest Sage without losing work

Hi. I first downloaded 8.1, but after updating to Node 0.12 there seem to be lots of problems and I want to migrate to the latest version of Sage. But I’m worried that pulling the latest code will overwrite all my work to date. What is the recommended way to do this?

1 Like
  1. Always make sure you’re working in a Git repo
  2. Make sure all your work is committed
  3. Add Sage as a remote git remote add upstream git@github.com:roots/sage.git
  4. Pull upstream changes git fetch upstream
  5. Rebase upstream changes into yours git rebase upstream/master
  6. Manually fix all conflicts (read: https://help.github.com/articles/resolving-merge-conflicts-after-a-git-rebase/ and http://tedfelix.com/software/git-conflict-resolution.html)

Note: if you just cloned Sage direct you can skip #3-5 and do these steps:

  1. git fetch
  2. git rebase origin/master

If you mess up the rebase process you can always reset your repo to the last good state/commit.

9 Likes

Thanks. I don’t think I did a great job of the merging, but am getting there

@swalkinshaw @hotbelgo how about if I just want to update to a specific release e.g 8.1.1? For example, I originally cloned 8.0, I want fixes from 8.1.1 but I am not ready to abandon less yet and want to keep the nav walker on a specific project.

@codecowboy Try cherry picking? that way You can pick small/security fixes that You want and leave out others.

Not much different.

You might need to do git fetch upstream --tags as well.

And then instead of git rebase upstream/master you’d just do git rebase upstream/8.1.1.

Thanks. There are some alternative ways to do it but your way sounds closer to what I wanted to do

How would i go updating bedrock but having sage inside it? Tried it but sage seemed to be deleted, maybe i messed it up a bit :smile: Will try again soon.

Is there a step 7 after we remove the conflicts? Do we need to commit or use git rebase --skip to finish that part or leave it open?

I managed to get my Trellis working with upstream updates in a separate repo. But bedrock is a bit different with sage in it.

Thanks.

I have one repo with Trellis, Sage and Bedrock. I removed these repos after I cloned them and created my own having them all like the Roots example project. Doing a rebase after adding an upstream ads changes to the root of the project, not to Trellis alone somehow. So my question is, did you resolve your issues @darjanpanic ? Seems to be a similar issue.

Update: Well with a root repo this adding of an upstream may not work as the upstream is for a fun directory not the base of the repo. I think I will start working with one repo for Trellis and one for the site - Bedrock and Sage. Seems to be better to keep Trellis update with the upstream added and doing a rebase