Merge and push changes with Git

Tuesday, 28th April, 2015

Part 3: Merge and push your local Drupal site changes to live with SourceTree.

This is the final part of a three-part tutorial where you will learn how to use a Git GUI with Drupal to make some theme tweaks on a live site. Part one of this tutorial starts here.

Overall we have covered the following so far:

  • Setting up a local stack (in this case Acquia Dev Desktop 2).
  • Creating an SSH key in Terminal on the Mac
  • Cloning an existing Drupal site repository using Sourcetree
  • Downloading and connecting to your live site's Drupal database dump file
  • Applying theme changes to the cloned site with CSS

Making your changes live with GIT

Here we cover the final steps of commiting, merging and pushing your changes to live with Sourcetree.

  • Refresh sourcetree using the GUI or keyboard shortcut [cmd+r].
  • Tick to select all the unstaged files, i.e. files you have been tweaking.
  • Click 'Commit'.

Commit Drupal site local changes in SourceTree

  • Add a brief commit message to describe what’s been done. We use Trello and add a link here to the relevant Trello card for the change(s) that have been made.
  • Confirm the commit by selecting commit in the alert box.
  • Click push (make sure still on the develop branch)
  • After not too long, depending on the number of changes, they should be reflected in the development environment.

Check your dev environment URL in the browser. You should see if the changes have been made, and all being good move on to the next step.

  • Double-click on Master Branch to switch to this branch.
  • Right-click develop branch and select ‘merge develop into master’ (see image below).

Merge the changes that are on the development environment into the live environment

Next, confirm the merge you are about to do in the prompt that comes up.

Confirm that you are merging the changes you want in SourceTree

The ‘Push’ icon should now display a number alert. This indicates the number of changes that are ready to push.

click to push your changes in SourceTree

  • Click the 'Push icon.

push the changes you have made locally into the repo master branch4

Now, give it a few seconds and check the live URL for the site. You may need to do a cache clear or refresh at least. Now you should see your changes reflected on the live site.

Thank you for following along on this three part tutorial. I hope you found it a useful starting block for getting familiar with a better way of working.

As always, if you have any questions or suggestions, just get in touch - we're happy to help out!

 

Curve
Drupal and UX Design Agency

UK Drupal Agency and UX Design Team with our very own usability testing lab in Leeds. We work with national charities, NGOs and private sector clients.