Difference between revisions of "DPS909 & OSD600 Winter 2017"

From CDOT Wiki
Jump to: navigation, search
(Week 4)
(Week 4)
Line 68: Line 68:
 
** It is always safe to branch, it won't change the code in any way
 
** It is always safe to branch, it won't change the code in any way
 
** Relationship of <code>git commit</code> with branches
 
** Relationship of <code>git commit</code> with branches
*** commit SHA, <code>HEAD</code>, branch
+
*** commit SHA: <code>e0ee2b5acd01acbe5b0bc1ee24b73e5d53a1fd70</code> or shortened to <code>e0ee2b5</code>
 +
*** <code>HEAD</code>: the most recent commit
 +
*** branch: an easy to remember name we give to the current commit, e.g., <code>master</code>
 
*** <code>master</code> branch vs. "Topic Branches": '''all work happens on a new branch'''
 
*** <code>master</code> branch vs. "Topic Branches": '''all work happens on a new branch'''
 
** creating, switching between, updating
 
** creating, switching between, updating
 
*** <code>git branch <branch name></code>: <code>-d</code> (maybe delete), <code>-D</code> (force delete), <code>-m</code> (rename), <code>-a</code> (list all)
 
*** <code>git branch <branch name></code>: <code>-d</code> (maybe delete), <code>-D</code> (force delete), <code>-m</code> (rename), <code>-a</code> (list all)
*** <code>git checkout <branch name></code>
+
*** <code>git checkout <branch name | commit SHA></code>, discussion of "detated HEAD"
 
*** <code>git checkout -b <branch name> [<base commit> | HEAD]</code>(create if doesn't exist, checkout new branch)
 
*** <code>git checkout -b <branch name> [<base commit> | HEAD]</code>(create if doesn't exist, checkout new branch)
 
*** <code>git checkout -B <branch name> [<base commit> | HEAD]</code> (create or reset, checkout new branch)
 
*** <code>git checkout -B <branch name> [<base commit> | HEAD]</code> (create or reset, checkout new branch)
Line 85: Line 87:
 
*** create pull request
 
*** create pull request
 
** merging
 
** merging
 +
*** A merge in git is a way of combining branches into a single branch/history
 +
*** We always fix bugs and add features on '''new branches''', but then we need to '''merge''' them back into the main '''master''' branch
 +
*** Merging doesn't change any of the branches it combines, it simply connects them.
 +
*** <code>git merge <branch name></code> merges <code><branch name></code> '''into''' the currently checked out branch
 +
*** Different merge algorithms
 +
**** fast-forward merge - given identical histories, move the branch ahead in the history to the new tip
 +
**** 3-way merge - divergent histories, use common ancestor commit (commit 1), and two branch tops (2, 3)
 +
 
*** recall that <code>git pull</code> does a <code>git fetch</code> and <code>git merge</code> in one step
 
*** recall that <code>git pull</code> does a <code>git fetch</code> and <code>git merge</code> in one step
 
** rebasing
 
** rebasing

Revision as of 14:20, 30 January 2017

Resources for DPS909 & OSD600

Week 1

  • Course introduction
  • Some questions:
    • What was the first video game you ever played?
    • What are your main technical strengths, which technologies do you know well and enjoy?
    • Which (new) technologies are you excited to learn and try?
    • When you hear "open source," what comes to mind?
    • Do you have any hesitation, fears, or anxieties about working in open source projects?
  • How to have Success in this course:
    • Willingness to be lost and not panic
    • Willingness to put yourself out there, jump in
    • Curiosity
    • Being driven, persistence
    • Willingness to ask for help
    • Willingness to give others help
    • Independent learning
    • Doing more than the bare minimum

Week 2

Week 3

Week 4

  • Working with git Branches
    • Lightweight, movable, reference (or pointer) to a commit
    • Series of commits: a branch is the furthest tip of a line of commits
    • It is always safe to branch, it won't change the code in any way
    • Relationship of git commit with branches
      • commit SHA: e0ee2b5acd01acbe5b0bc1ee24b73e5d53a1fd70 or shortened to e0ee2b5
      • HEAD: the most recent commit
      • branch: an easy to remember name we give to the current commit, e.g., master
      • master branch vs. "Topic Branches": all work happens on a new branch
    • creating, switching between, updating
      • git branch <branch name>: -d (maybe delete), -D (force delete), -m (rename), -a (list all)
      • git checkout <branch name | commit SHA>, discussion of "detated HEAD"
      • git checkout -b <branch name> [<base commit> | HEAD](create if doesn't exist, checkout new branch)
      • git checkout -B <branch name> [<base commit> | HEAD] (create or reset, checkout new branch)
    • local vs. remote, tracking branches
    • common workflow
      • git checkout master - switch to master branch
      • git pull upstream master - pull in any new commits from the upstream/master branch
      • git checkout -b issue-1234 - create a topic branch for your work, named with bug #
      • git add files - edit files, add to staging area
      • git commit -m "Fix #1234: ..." - commit changes, referencing bug # in commit message
      • git push origin issue-1234 - push your topic branch (and all commits) to your origin repo
      • create pull request
    • merging
      • A merge in git is a way of combining branches into a single branch/history
      • We always fix bugs and add features on new branches, but then we need to merge them back into the main master branch
      • Merging doesn't change any of the branches it combines, it simply connects them.
      • git merge <branch name> merges <branch name> into the currently checked out branch
      • Different merge algorithms
        • fast-forward merge - given identical histories, move the branch ahead in the history to the new tip
        • 3-way merge - divergent histories, use common ancestor commit (commit 1), and two branch tops (2, 3)