Github

From Soma-notes
Jump to navigation Jump to search

When using github for a school project, it is recommended that you do not fully trust each other to do the right thing. For this reason we recommend the Review To Commit (RTC) pattern. Note RTC is a bit of a misnomer for a git-oriented workflow-- it could more accurately be called Review to Merge.

Here is a diagram of the idealized untrusted development workflow:

Diagram-1.gif

Here is the script we went through (or at least, intended to) in class:

  • Change to CarletonU-COMP2406-W2013 account perspective (top-left)
  • Show all repos (right), news feed (center)
  • Choose Demo-Repo (repo hereafter "mothership")
  • fork to private github account (top right) (repo hereafter "fork")
  • grab SSH URL
  • git clone [fork's SSH URL]
  • show contents of directory (note .git, .gitignore, REAMDE.md)
  • create issue in mothership "need index.html"
  • assign issue to self
  • git checkout -b new-index
  • git branch (show new branch)
  • create index.html
  • git status (show index.html needs to be added)
  • git add .
  • git status (show index.html staged for commit)
  • git commit -am "adding index.html, fixes #1

added basic head added empty body"

  • git status (nothing to commit)
  • git push origin new-index
  • go to fork's github page
  • create pull request from fork new-index to mothership master
  • look at pull request in mothership
  • comment on incorrect tag in github diff (pretending you're a team mate)
  • fix broken tag
  • git status
  • git commit -am "fixing broken tag"
  • git push
  • Note pull request has update self with new commit
  • accept pull request (pretending you're a team mate)
  • Note #1 has closed itself because it was mentioned in commit with "fixes"
  • git remote -v
  • note "origin" is assigned to fork
  • copy mothership's SSH URL
  • git help remote (show how to get help on a command)
  • git remote add mothership [mothership's URL]
  • git checkout master
  • git pull mothership (gets your changes from new-index)
  • git branch -d new-index (deletes new-index)
  • add "foo" to body of index.html in github (pretending you're a team mate)
  • add "bar" to body of index.html locally
  • git status
  • git commit -am "adding bar"
  • git pull mothership (merge conflict!)
  • resolve merge conflict
  • git commit -am "resolving merge conflict"
  • add "baz" to body of index.html
  • git status (index is staged for commit)
  • git stash (branch is back to nothing changed)
  • git stash pop (baz is back)
  • git commit -am "adding baz" (oh no, I don't actually like this change)
  • git reset HEAD^
  • git status (baz is still there, but not commited)