Lessons Learned: Merging Branches

The areas I’m least comfortable with is starting and ending a project. More specifically, a project with more than just me as a contributor.

It’s always a good idea to update your README.txt file so that it’s easy for new contributors to get their environment set up. Still doesn’t make me super confident, but I’m sure that comes with experience.

What makes me more nervous though, is when you’re ready to push. This week I was updating the company website as part of my internship and after making the changes and received approvals, I was ready to push. Here’s the process I took:

Ready to merge

This allows you to get the most recent version of code which is especially important if you have more than one developers working on the site.
From your branch (lets call it branchname)
git checkout master
git pull

From master:
git checkout branchname

Now that your back in your branch, you want to merge master with branchname and not the other way around. This allows you to check to see if any of your changes will conflict with anything recently changed by another developer.
If there are conflicts, you’ll need to sort them out and determine which ones to keep.

If there are no conflicts and you are ready to merge your branchname into master
git checkout master
git merge branchname

Now they are merged together but your not done yet. You still need to actually push these changes to the repository and to your host.
git push origin master (to your repository)
git push heroku master (to the host, it this example, heroku)

Back to blog
JSON-LD for SEO logo

Get more organic search traffic for your Shopify store