TUTORIAL: How to Git as a Group - radiatoryang/fall2018_gamedev1_morning GitHub Wiki

SETUP

  • everyone: make sure you are not on the "master" branch, don't work directly on master!
    in Sublime Merge menu bar: Repository > Create Branch > type "[your name]-develop" > [enter]
  • if you have the master repo: add collaborators to the master repo
    in GitHub.com, go to your repo's settings and add each group member as a Collaborator (you will need every group member's GitHub username)
  • if you have forked the repo: add the master remote as the "upstream"
    in Sublime Merge menu bar: Tools > Command Palette (CTRL+P)... and then type:
    Add Remote > [enter] > "upstream" > [enter] > [paste URL of master repo] > [enter]

After setup, there are two patterns you have to practice and remember:

  • HOW TO GET THEIR WORK
  • HOW TO SHARE YOUR WORK

HOW TO GET THEIR WORK: get files from master branch

summary: merge upstream/master into your local "develop" branch

  1. FETCH: updates your map view inside Sublime Merge
    • open the sidebar (click the button in top-left)
    • right-click on "upstream" (or "origin") and Fetch
    • if nothing happened, that means you already see the latest updates
  2. MERGE:
    • make sure you are on your develop branch
    • right-click on it and select "merge upstream/master into develop"
  3. RESOLVE ANY MERGE CONFLICTS:
    • on a conflicted file, click "Resolve" button
    • in resolve mode, click the arrows next to the line numbers, and choose which version of the chunk to use
    • when you have resolved all conflicts, click "Save" button in upper-right
  4. COMMIT THE MERGE

HOW TO SHARE YOUR WORK: put your files on master branch

summary: first get everyone's work and resolve merge conflicts... then, push to GitHub and submit a pull request from your fork

  1. TEST YOUR CODE, DO NOT SHARE BROKEN STUFF
  2. FETCH: (see "How To Get Their Work")
  3. MERGE: (see above)
  4. RESOLVE MERGE CONFLICTS
  5. COMMIT THE MERGE
  6. PUSH YOUR DEVELOP BRANCH
  7. MAKE A PULL REQUEST
    • look at your GitHub fork in browser, verify the push worked
    • click "Pull Requests" and create a Pull Request
    • in the PR, the "base" should be your group main repo's master branch... and the "compare" should be your develop
    • click "Create Pull Request"
  8. YOUR GROUP SHOULD LOOK AT THE PR
    • if you had a job, your boss would review your code or assets
    • but in your group, your fellow students should review the code
    • if you look at their code / files, and everything seems OK, then write a comment "looks good to me" - if you need a closer look, you can "Checkout" their develop branch and double-check everything
    • if you are the last reviewer and everyone says it's good, you can click "Merge Pull Request"
    • NEVER MERGE YOUR OWN PULL REQUEST!!! THAT DEFEATS THE PURPOSE OF ALL THIS, AND OUTSIDE OF SCHOOL THIS WILL GET YOU IN TROUBLE
⚠️ **GitHub.com Fallback** ⚠️