git basics are presupposed
Throughout this guide we will be assuming that you are familiar with some of the key
git concepts, like commits, branches, remotes, and merging. If you need a refresher we recommend these presentation:
Git for humans by Alice Bartlett (highly recommended intro to git)
One of the key features of the drie platform is that you can use git branches to create new versions of your applications. Creating a branch in git allows you to create a copy of your code to work on independently from other people who are working on the codebase.
drie takes this ability one step further by building and deploying each of the branches that you create to the drie platform running in your AWS account.
When you have deployed your first application to drie you will see something like the following in your drie dashboard:
We have our application
drie-php-starter-app deployed to drie. Currently, this application only has one branch, master, and that branch is deployed to drie. You can see the details of this deployment by clicking the link to “view”.
We want to create a second version of our application though. This is because we want to try out some changes in the application and don’t want to affect what we already have deployed from the master branch.
We can do this either on the command line or in the GitHub UI. In this example we will show using the command line.
Go to your checked out copy of the
drie-php-starter-app code in your terminal and type the following to create a new branch:
`git checkout -b my-new-feature`
Now make some changes to your code. In this example we are going to change the welcome message that you get when you hit the homepage, which involves making a change in
/resources/views/welcome.blade.php. We’ll then commit that change.
git add /resources/views/welcome.blade.php git commit -m “Changing welcome message”
We can push this change to drie and see the new version of our application build, just by pushing the change to GitHub:
git push origin my-new-feature
This will push the branch to the repository’s origin on GitHub.com, where it is picked up by drie. drie will build and deploy the application to an on-demand instance. If you return to the dashboard you will now see the second branch:
When you click through to view the my-new-feature branch you will see that it has built and has a URL served over HTTPS that you can visit and where you can see your build and application logs.
This branch has the change that we made to the code on it, which we can see if we visit the URL:
Any further changes we commit and push to this branch will be built and deployed on this URL so we can revisit it to see the changes that we are making as we go along.