Git Yourself a Leg Up – GitHub Tools for Teams and Teaching

Posted by

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

This year at Pycon Au 2023, I gave a talk in the Education Track, highlighting a collection of cool GitHub tools and techniques to combine in an interesting way that is great for learners, teachers, and pro-developers alike.


Not only did I get to speak about my all-time favourite analogy, “How is Git like an Instagram-worthy shopping trip?” (which I’ve described in my previous blog: Get started with Git), but also got to discuss a new way of using some of the newer GitHub tools, in the classroom, the workplace and more.


This set of tools is:

  • GitHub Templates
  • Codespaces
  • GitHub Actions
  • And GitHub Copilot (if you’re a teacher, maybe keep this part just for yourself, like I do in the video).


In this blog I’ll explain how you can combine all these pieces of tech to have a project template, a dev environment that runs in the browser, and automated tests that run with each push. And I’ll also tell you how you can use Copilot, either while you’re using a template or creating one (it’s great for writing those automated test cases)!

You can watch the video for the full video here.

Access the slides here.

Access the project template repo here.
All the links from the end of my talk are at the bottom of the blog!


If you are new to Git and GitHub, I cover my great Git analogy at the start of the video (but not in this blog). Be sure to check out my previous blog Get Started with Git, which has explanations, pics, and links to more videos by me about Git where I discuss this analogy further.


Using “templates” or actual “GitHub Templates”
The rest of this blog follows through the demo I show in the video starting at this time stamp.


When I’m live streaming, I love to use a template. It’s a great way for people to get involved without having to set everything up from scratch. You get to jump right to the important part of the lesson. But templates have so many other uses as well. They are great for use in the classroom to give students a starting point, and they’re great in industry when you have a standard project design structure that you regularly reuse for different customers or projects.

I’ve been using templates for a while in my streams, for instance where learners forked my portfolio template repo and customised it to create their own portfolio website. (If you want to make your own portfolio, you can watch the streams here for episode 1 and episode 2 and use these Microsoft Learn resources).

But the thing I didn’t know is that I was making a “template”, not a real “GitHub Template”, a newer feature I hadn’t heard about yet! And it was as simple as clicking one check box at the top of the Settings page for the repo to turn it into a real “GitHub Template”:




Why use "GitHub Templates"?

Having learners fork a repo was fine for many, but still a bit tricky for some.

There are some benefits for using a GitHub Template that I wasn’t getting...


Clean commit history.
Whether you’re using a template for learners, for a new customer project, or for your own purposes, you want that to be the start of your project. Forking a repo gives you the whole yucky history. Using a template start you off with the template code/set up and nothing extra.

You don’t want all of the history of the template to be included in repo when you create a new instance of the template. This might be important because repo history could have previously contained the answers for a student project or confidential information that shouldn’t be shared with a new customer as part of their project.

Make multiple copies.
You are unable to fork your own repo. And when forking someone else’s repo you can only fork it once. But making a repo a GitHub Template removes this issue.

GitHub Templates can be used as many times as you want by whoever has access to it.


Easier concept for new GitHub users.
“Forking a repo” is not something that is necessarily easy to understand. However, “using a template” is common terminology that even younger learners or new team members can pick up with ease.

To use the template, all users need to do is click this button.


This means that as you start on the project, you don’t have to address all of the Git concepts, and you can teach them as they become necessary.


Adding Codespaces to our template

We now have a template that students or developers can get their base code from. But giving them an environment that is set up to work with their code would be even better. Codespaces is the answer!


Codespaces are a dev environment that runs in the cloud where you can write and run code in from your browser. It’s built right into GitHub, and you have access to use if straight from your repo’s main screen.


Code spaces are easy to get started with but are also fully customisable if you want that. So, when you set up an environment for your project, here are options for how much you want to do in the set up.


Option 1. Default Codespaces
When using the template, the user can just click “Create codespace on main” and start working in the default Codespace environment.


If you don’t have many requirements, that might be the easiest option, and VS Code will prompt users to add things like the Python extension when it detects the Python files anyway. No effort required and now you can write and run code in the browser!


Option 2. Choose an image

If you want to set up some specifications for the project environment, you can choose from one of the Codespaces images and use the default settings there.


In this example, I selected “add Dev Container Configuration files” from the Command Palate.



You can modify your existing configuration or add a brand-new one. (I’ve said modify, even though I don’t have an existing file, just the basic Codespace setup)


Then, I chose a Python image.



Finally, that generates the devcontainer.json file for me that defines my environment and includes the correct environment image for the Python use case I specified. When I commit that, it will be part of the template repo and all template users will get this image information.



Option 3. Custom Container

If you want to specify more things, you can do it in the devcontainer.json file, and then all users of the template will also get the environment any extras as defined in the file.


You can specify the image as in Option 2 above, as well as VS Code extensions, ports to forward, and more.




Coding with Copilot

Now it’s time to write some code! But why not do it with a digital buddy.


Copilot is great at turning comments into code or autocompleting your line of code as you write it. I found it particularly useful for writing the test cases for this example project, where I wanted to run automated tests on each push to the main branch.


You can see from this clip how speedy it was to write my Pytest cases (and Pytest is not even the testing framework I am familiar with, so it can help you out a lot!). It is really quite magical, so I suggest giving it a try (and it works in more human languages than just English!).

Copilot is free for educators, students (age 13+), and open-source project maintainers. For students and teachers, you should apply for the GitHub Student Developer Pack to gain your free access. Open-source contributors will automatically be notified if you qualify when you look at the subscriptions page in GitHub settings for your account.

Run tests automatically

When I set up automated testing the first time, I was worried it would be quite an involved process and difficult to figure out. I couldn’t have been more wrong, it was only a few clicks to have automated Python tests running with Pytest.  


Once you have your repo set up with your Python code and Python tests, it’s just a few easy steps:


  1. Click on Actions in the top bar.
  1. Select Python Application from the suggested options.



  1. It generates the test runner for you, you can see the Pytest configuration right at the bottom. You just need to commit the file with the green button at the top, and it will be ready to go!


    If you aren’t using Python and Pytest, there are a lot of other pre-configuration options. You can also customise the generated runner code for your use case.


  1. Now, when you push new code to the main branch, it will run the tests automatically.  You can see the results of all runs and inspect the logs for errors.

Here are a few tips if you are doing this with Python and Pytest (GitHub will autogenerate automated testing for Pytest).

  1. Make sure you have a requirements.txt file that imports pytest
  2. Make sure your testing files start with “test”, eg “”
  3. If you are setting this up for students, have code on hand that passes the tests so you can test the automation and your test cases.
  4. If you are setting this up for students, remember not to commit your answer code to the template. Instead, use your template and test your solutions on that new repo. You can delete them from your repo, but students can see the commit history on the template (Even though they don’t get the commit history when they say “Use Template”).



This is a format I look forward to using to create content in the future, I hope you can use it in your workplaces, classroom, or life too!


To access the resources and programs  I mentioned at the end of the video, you can use the following links:


Join my Cloud Skills Challenge
"Get Learning with Git - Git skills and GitHub tools"

You'll learn the various skills I just talked about so you can combine them to make your own templates!


Be an entrepreneur! 

Microsoft for Start-ups Founders Hub 

Get your start-up idea off the ground with some free Azure credits and advice from the Founders Hub team. As your idea grows, take advantage of even more resources. 


Imagine Cup 

Don’t forget to sign up for Imagine Cup to start solving problems and the chance to win $100,000 USD and mentorship from Microsoft CEO Satya Nadella! 


Imagine Cup Junior

A design thinking competition for students under 16 years.


Join Our Communities!

Microsoft Learn Student Ambassadors 

Support your community to learn more and build your leadership skills by becoming an ambassador! 


Become a Most Valuable Professional (MVP) 

If you want to get involved in our Microsoft, you can look at what it means to be an MVP (Most Valuable Professional).


Free stuff for students! 

Azure for Students 

Get free Azure cloud credits and access to essential cloud products that are free for students! 


GitHub Student Developer Pack 

Get all the free GitHub resources for students, including GitHub Copilot, extra Codespaces quota, and learning resources. Check out this blog if you need help getting signed up. 




Thanks for reading! To stay up to date with what I’m doing, you can check out the links on my LinkTree. If you follow through to my personal website, you’ll find even more videos by me!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.