Infrastructure as Code example

IoC examples using Azure

View on GitHub
Home Github basics part 1 Terraform basics part 1 Terraform Examples Github collaboration

Github - Part two - collaborate using github!

In this lesson we will start to use branches, merge and send pull requests. This is needed to collaborate with others on Github.


Github branch: The basics

Exercise:

  1. Choose: “New Branch” in Github Desktop, name: adding-sqlserver
  2. You now get the choice between: Leave my changes on main or Bring my changes to adding-sqlserver, choose Leave my changes on main
  3. Now Publish your new branch to GitHub
  4. Do a code change, see example below
  5. Commit and push your changes to Github

Result:

    This will create a new branch in your repository where your new changes will live.
    The Main-branch will exist untouched and represent your production state.

Example code change


Github Pull requests. The basics

Exercise:

  1. Go to your project on https://github.com and choose Pull requests
  2. The list should be empty, so start with New pull request
  3. In this first step you compare the changes and Github analysis if it’s able to merge the two branches automatically
    1. First choose where you want the changes to end up, your target branch
    2. Then choose where your changes are stored now
    3. When you have reviewed the changes and Github has confirmed that this merged can be done automatically, your ready for the next step.
  4. The next step is creating the Pull request
    1. Here you can assign Reviewers and other project specific details about your change, before creating it
    2. Now the task of reviewing and acception the change should be given to a co-worker
  5. You finish the Pull request with either just Closing the request without accepting the request or merge pull request if you accept it
    1. It is in this step all automatic integrationtests should be done
  6. Delete branch is an recommended option that you have after merging is done
    • It is normal to keep a feature branch clean and only implement one feature on it before merging. In these cases you should always delete your branch.
    • Without deleting old feature branches you will end up with a lot of branches (chaos)
    • Yes, you could have end up with a bugfix for your new feature, but then that should also be it’s own branch.

Note: If you need to, you can also compare across forks.

Result:

    All your changes are now moved to your target branch and the Pull request is closed.

More information