Skip to content

Commit

Permalink
reorganized files into folders for each lab, added content for lab2
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsakuma committed Oct 6, 2014
1 parent 3b2c7cc commit 3528857
Show file tree
Hide file tree
Showing 8 changed files with 23,799 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
130 changes: 130 additions & 0 deletions Labs/Lab1/DAT10-git-tutorial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"metadata": {
"name": "",
"signature": "sha256:3780c4b365406547257760627a497aea925f3118088e8a762e783a01234edbfe"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# GA Data Science 10 (DAT10) - git overview\n",
"\n",
"This lab is an overview and example of `git`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. High Level Overview\n",
"\n",
"- the purpose of `git` is to keep snapshots of the *'state of the filesystem'* as it changes over time\n",
"- git stores these snapshots in a *'repository'*\n",
"- specifically, `git` data is kept in the `.git` folder in the top-level directory of the repo\n",
"- i.e. there is a relationship between a `git` repo and the filesystem"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"There are two primary objects that are key to understanding `git`:\n",
"#### `commit` object:\n",
"\n",
"- set of files (and directories) - i.e. a *'snapshot'*\n",
"- pointer to one or more *parent* commit objects\n",
"- unique name based on SHA1 hash\n",
"- meta-data - e.g. commit message\n",
"- commit process:\n",
" - git add [filename]\n",
" - git commit -m \"[insert message here]\"\n",
"\n",
"#### `head` object:\n",
"\n",
"- pointer to a `commit` object\n",
"- each `head` has a name (i.e. the name of the branch)\n",
"- at any given time there is a `head` that is the *'current head'*\n",
"- the *'current head'* has the supplemental alias `HEAD`\n",
"- by default there is a `head` called ***master*** in every repository"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A `git` repository has a particular logical structure:\n",
"\n",
"- think of each `commit` object as a snapshot of the file system at a point in time\n",
"- `commit` objects are linked together, forming a *directed graph*\n",
"- the *'initial commit'* is the root of the graph\n",
"- `head` objects are just pointers to specific `commits`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 2. `git` setup\n",
"\n",
"Copy the clone link from github:\n",
"https://github.com/ga-students/DAT_SF_10\n",
"\n",
"$ git clone [link from github]\n",
"\n",
" - creates a new directory (i.e. with the name of the cloned repo)\n",
" - initialize a new git repository in the new directory\n",
" - copy all the commit objects and head references into the new repository\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Many settings are relative to the current repo, but some are set globally:\n",
"\n",
" $ git config global -l\n",
" \n",
" user.name=Dow Street\n",
" [email protected]\n",
" \n",
" \n",
"Additional settings, for example you can set your editor to something other than `vi` - e.g. `nano`:\n",
" diff.external=/Users/dowstreet/bin/git-diff-cmd.sh\n",
" merge.tool=opendiff\n",
" color.ui=true\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Other useful commands:\n",
"\n",
" Use this all the time!\n",
"\n",
" $ git status\n",
" \n",
" Show the commit and branch graph\n",
" \n",
" $ git log --graph --oneline --all\n",
" "
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Loading

0 comments on commit 3528857

Please sign in to comment.