Introducing branches and pull requests: recommendations?


(Ianframe) #1

I’ve been using GitHub Classroom in my Data Structures & Algorithms class this year and have really enjoyed the ease of getting students their own repos and providing feedback on their commits. So far students have only been making commits to the master branch and haven’t used other branches or pull requests. Next I’m wanting to introduce branching and pull requests in the second half of the course.

I’m wondering if anyone has a project/assignment/set of instructions that does a nice job of introducing branching and pull requests, specifically for collaboration amongst peers? Rather than start from scratch, I’m curious if anyone already has something in place that has been effective at introducing these concepts to their students.


(Vanessa) #2

@ianframe here are a few options from GitHub and from fellow teachers:

  • See slide 29 of Yes, you can git it from Carol Willing, Research Software Engineer, Project Jupyter at Cal Poly SLO
Yes, you can git! from Carol Willing

(Also I am going to edit the H1 so more people can find it)


(Brian) #3

Starting with non-code projects can help new users see the value in forks, branches, and pull requests. A friend of mine taught himself by setting up a challenge with some song lyrics and posting it on his blog. You may be able to modify something like this to teach the mechanics before diving into code version control.


(Carl Boettiger) #4

Great question; in addition to the pedagogical issues that the other replies speak to, there’s some simple choices in the mechanics of exactly how you introduce pull requests.

For instance:

  • Have students create a fork, make edits, and send a pull request for a repository where they do not have commit rights. (e.g. if you are using Classroom without team-based repos)

vs

  • Have students on the same team (i.e. both have commit rights to the team repo) create a branch within the repo, push the branch to github, and create a PR

I think the former is conceptually easier to introduce, since the purpose of having a way to suggest edits to a project where you don’t have commit rights is more self-evident than the purpose(s) of having branches within a project.

It is also worth noting that maybe either of these approaches would be easiest to introduce with the (relatively new) inline editing of a file on GitHub that allows you to create a PR for edits to a single file without creating an actual fork or local branch.