How to Merge a Feature Branch that Completely Changes the Project Structure

Wednesday, December 2, 2020

I recently updated my site from Jekyll to Scully. These are, obviously, two entirely different frameworks and project types. There was no easy way to merge my scully branch into the master branch. I found a StackOverflow answer though that helped me out. Essentially, you can merge master into your branch with a flag setting the strategy to ours. That means that any differences between master and scully will be accepted in favor of scully. After doing that merge, I checked out the master branch and merged scully into master. Because I had a PR already opened, this also closed my PR.

In short, here's the way to do this:

git checkout master && git pull origin master
git checkout scully
git merge -s ours master
git checkout master
git merge scully

Like I said, if you have a PR open for this, it will close the PR. And your project will now match whatever the project structure looked like on the scully branch.

Code Examples


Preston Lamb

I'm a JavaScript developer, husband, and father of four from Roy, UT. I've spent the last five years working with Angular on the frontend and Node on the backend. I also write blog posts, create training courses for Thinkster.io, and love learning more about web development. In my free time I like to spend time with my family and play or watch basketball (Go Jazz!).

Have a question or comment?