Skip to main content

Day 5 - Collaborative Git II

Achievements I

  • All git focused achievements
  • Due: Friday October 14
  • As these are achievements focused on “how” we work with code instead of “what” we do with code, you can use situations from other assignments that relate to the respective achievement options.

Review from Yesterday

  • Merge Conflict: when someone tries to push code that changes something that has already been changed in remote without pulling first
  • Branches: alternate versions of a code base
  • Pull Request: when you move code from one branch to another

Questions and Examples

  • Walk through code used from yesterday
  • Address any issues regarding branching or merging conflicts
  • Code from today’s lecture
    • this provides examples of:
      • merge conflicts
      • branches and pull requests

Pair coding: Commit catch (30 minutes)

Tasks

  • Take turns playing commit catch as we did yesterday
  • Make 2-3 commits back and forth in a feature branch
    • Name your feature branch appropriately for the work you’re doing
  • Then open a pull request to merge the code down into the main branch
    • Squash and Merge to keep your main git history organized
    • Label your PR’s appropriately (do not be vague)
  • If you finish early, or want an extra challenge:
    • Add merge conflict resolution practice to commit catch in the branch

Show and Tell

  • quick showcase of what your team was able to do. 1 person will screenshare

How to make a Pull Request

  • Github Docs
  • Basic Method (follow these steps):
    • create a feature branch with git checkout -b branchname
    • edit code in your feature branch
    • push the code to the remote feature branch (follow instructions in the terminal if the branch isn’t in remote yet)
    • open a pull request
    • accept it and merge the code down

Make good quality PRs

  • Title and summary should be clear and concise
  • describe your changes well in each commit
  • keep it small
    • make a pr that focuses on 1 thing. don’t make PRs that aim to do lots of different things
  • test your code before submitting a PR
    • Do not submit broken code
    • Sometimes when we change too many things, unexpected breaks can occur
      • before submitting, double check that everything still looks good
  • Lots of information can be found in this gist

Commit Catch PR Showdown

Instructions

  • pair off in your groups of 4 (2 teams of 2)
  • You will all be using the same repo
  • Each team opens up a feature branch and edit text in a specific file (each team uses their own file)
    • pass 4 commits back and forth (resolve any conflicts that occur)
  • When you’ve finished your 4 commits, one of you opens a PR to merge into main, the other Has to add a +1 in the PR comment section before merging down (failure to do this will mean that you don’t get a point)
  • Merge the code to main and gain a point
  • the other team must pull your changes from main into their feature branch before continuing

Goal

  • Merge the most number of PRs with at least 4 commits each

Special Guest: Jessica Watson (SAIT Web Dev Graduate)


Lab Time

  • Support for git related questions
  • Work on Assignments
  • Work on Achievements