Skip to content

Instantly share code, notes, and snippets.

@karlkaebnick
Last active March 9, 2019 21:04
Show Gist options
  • Save karlkaebnick/85b40f2fe32fc4b32ea289de0fbd15de to your computer and use it in GitHub Desktop.
Save karlkaebnick/85b40f2fe32fc4b32ea289de0fbd15de to your computer and use it in GitHub Desktop.
How to create a new master branch for a drupal instance
  • verify the new branch has been tested in stage

  • make a backup of current master branch:

    • production drupal instance should be pointing at existing master branch right now
    • create a backup of current master and point production drupal instance to it:
      • checkout the master branch:
        git checkout master
      • make sure you have latest changes for master branch:
        git pull
      • create a backup of the current master branch:
        git checkout -b master_backup_<yyymmdd>
      • push this backup branch to the remote repo:
        git push origin master_backup_<yyymmdd>
    • now switch production drupal instance to the backup master branch you just created
  • now create the new master branch:

    • checkout the new branch:
      git checkout <new branch>
    • make sure you have latest changes for the new branch:
      git pull
    • make sure the branch's symlinks are intact:
      bin/build_symlinks.sh
      (then add, commit and push any symlinks that get created)
    • rename the new branch to 'master':
      git branch -M master
    • push the new master to the remote origin (note: the 'force flag' -f is required because we are over-writing the existing master):
      git push -f origin master
    • now point production drupal instance to the new master
  • now switch production drupal instance back to 'master'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment