Changes

Jump to: navigation, search

DPS909 & OSD600 Winter 2017

1,526 bytes added, 12:38, 30 January 2017
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 <code>git commit</code> with branches*** commit SHA, <code>HEAD</code>, branch*** <code>master</code> branch vs. "Topic Branches": '''all work happens on a new branch'''** 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 checkout <branch name></code>*** <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)
** local vs. remote, tracking branches
** common workflow
*** <code>git checkout master</code> - switch to master branch
*** <code>git pull upstream master</code> - pull in any new commits from the upstream/master branch
*** <code>git checkout -b issue-1234</code> - create a topic branch for your work, named with bug #
*** <code>git add files</code> - edit files, add to staging area
*** <code>git commit -m "Fix #1234: ..."</code> - commit changes, referencing bug # in commit message
*** <code>git push origin issue-1234</code> - push your topic branch (and all commits) to your origin repo
*** create pull request
** merging
*** recall that <code>git pull</code> does a <code>git fetch</code> and <code>git merge</code> in one step
** rebasing
** gh-pages

Navigation menu