Skip to content

Commit

Permalink
intro page completed
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Feb 8, 2009
1 parent a7cbab9 commit 88b85a0
Show file tree
Hide file tree
Showing 10 changed files with 350 additions and 7 deletions.
7 changes: 5 additions & 2 deletions Rakefile
@@ -1,4 +1,6 @@
require 'rubygems'
require 'erb'
require 'maruku'

def generate_page(page_data)
page = page_data['page']
Expand All @@ -9,7 +11,7 @@ def generate_page(page_data)
# add video if present
if code = page_data['cast']
@pcontent += '<embed src="http://blip.tv/play/' + code
@pcontent += '" type="application/x-shockwave-flash" width="790" height="400" '
@pcontent += '" type="application/x-shockwave-flash" width="640" height="360" '
@pcontent += 'allowscriptaccess="always" allowfullscreen="true"></embed>'
@pcontent += '<hr/>'
end
Expand All @@ -18,7 +20,8 @@ def generate_page(page_data)
mpage = "pages/#{page}.markdown"
if File.exists?(mpage)
content = File.read(mpage)
@pcontent += content
doc = Maruku.new(content)
@pcontent += doc.to_html
@pcontent += '<br/><br/><hr/>'
end

Expand Down
4 changes: 4 additions & 0 deletions css/style.css
Expand Up @@ -13,6 +13,10 @@ h2 { background: #ddd; text-align: center; padding: 4px; }
#footer a { color: #444; }

.info, .fork { padding: 10px; }
.content { font-size: 1.3em; }
.content h3 { background: #eee; padding: 5px 2px; }

pre { padding: 20px; background: #ffd; }

#links { padding: 10px; }

Expand Down
Binary file added images/git-lang.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/snapshots.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
109 changes: 107 additions & 2 deletions p/intro.html
Expand Up @@ -41,8 +41,113 @@ <h1>Introduction To Git</h1>
<p>What Git is, why you would want to use it and where to get it and learn about it.</p>
</div>

<div class="span-21"><embed src="http://blip.tv/play/AeD_CQA" type="application/x-shockwave-flash" width="790" height="400" allowscriptaccess="always" allowfullscreen="true"></embed><hr/>hello
<br/><br/><hr/></div>
<div class="content">
<div class="span-21"><embed src="http://blip.tv/play/AeD_CQA" type="application/x-shockwave-flash" width="640" height="360" allowscriptaccess="always" allowfullscreen="true"></embed><hr/><p>Welcome to the first lesson of the GitHub Learning course. This course will lead you through a series of lessons that will demonstrate how to use Git quickly and easily - many of the lessons will have screencasts that you can watch as well, if you learn better that way.</p>

<p>This chapter is about what Git is and why you should use it - just a quick introduction before we start using it.</p>

<p>Git is a <strong>fast, open source, distributed version</strong> control system that is quickly replacing subversion in open source and corporate programming communities.</p>

<h3 id='version_control_system'>version control system</h3>

<p>First off, Git is a <em>version control system</em>, a simple command line tool for keeping a history on the state of your source code projects. You use it as you might use something like Subversion, CVS or Perforce.</p>

<p>You tell it to track files in your project and periodically commit the state of the project when you want a saved point. Then you can share that history with other developers for collaboration, merge between their work and yours, and compare or revert to previous versions of the project or individual files.</p>

<p>As it is primarily a command line tool, most of the examples in this course will show the command line versions of the functions. We will be using a recent version of Git (the 1.6 series) for the examples in this course. We recommend upgrading to the 1.6 series if your version of Git is older - there have been a number of UI improvements that make Git a bit easier to use.</p>

<pre><code>$ git --version
git version 1.6.1.2</code></pre>

<p>If you need help with any of the commands, you can type &#8217;&#8211;help&#8217; and it will show you the <em>man</em> page. You can also type &#8216;git help <em>command</em>&#8217; for the same thing.</p>

<pre><code>$ git log --help
$ git help log</code></pre>

<h3 id='open_source'>open source</h3>

<p>Git is an open source project, that has been active for several years and is written mostly in C.</p>

<p><img src='../images/git-lang.png' alt='Git Language Breakdown' /></p>

<p>At any time you can get the full source code to analyze or improve upon. To get a download of the source code, visit <a href='http://git-scm.com/download'>git-scm.com/download</a>. Git is licensed under the GNU General Public License.</p>

<h3 id='offline_and_fast'>offline and fast</h3>

<p>Git is fully distributed, which means that it can work almost entirely offline. In stark contrast to VCS tools like Perforce or Subversion, Git does nearly all of it&#8217;s operations without needing a network connection, including history viewing, difference viewing and commiting.</p>

<p>This also means that Git is very fast compared to those systems partially due to the fact that none of these operations has any dependency on network latency. For example, take a look at how fast the simple &#8216;log&#8217; command takes to run in Git and in Subversion.</p>

<pre><code>[master]$ time git log &gt; /dev/null

real 0m0.352s
user 0m0.300s
sys 0m0.034s

$ time svn log &gt; /dev/null

real 0m3.709s
user 0m0.482s
sys 0m0.168s</code></pre>

<p>Git at 0.3 seconds vs Subversion at 3.7 seconds. That is a difference of a full order of magnatude. You&#8217;ll find similar differences with nearly any command comparison. For example, adding the popular famfamfam icon set and committing them. Since you can seperate the commit from the network &#8216;push&#8217; in Git, this action takes a quarter of a second in Git, but 45 seconds in Subversion.</p>

<pre><code>time &#39;git add icons; git commit -m &quot;added icons&quot;&#39;

real 0m0.273s
user 0m0.032s
sys 0m0.008s

time &#39;svn add icons; svn commit -m &quot;added icons&quot;&#39;

real 0m45.276s
user 0m15.997s
sys 0m5.503s</code></pre>

<p>Even if you needed to push to a shared repository at that time as well, it still takes far, far less time than Subversion.</p>

<pre><code>time git push

real 0m6.219s
user 0m0.023s
sys 0m0.011s </code></pre>

<p>If you just want to commit and keep working, you&#8217;re looking at a huge time difference - one that severely changes your workflow. Most commands in Git seem instantaneous - no more typing &#8216;svn commit&#8217; and then going for a cup of coffee.</p>

<h3 id='small_vs_svn'>small (vs svn)</h3>

<p>Git is also very space efficient. For example, the Django project has mirrors in several currently popular source control systems, and of all of them, the Git clone is the smallest.</p>

<pre><code>$ du -d 1 -h
108M ./django-bzr
44M ./django-git
53M ./django-hg
53M ./django-svn</code></pre>

<p>Interestingly, it is even smaller than the Subversion checkout, which is pretty amazing, considering that the Git clone contains the entire history of the project - every version of every file back to the first commit, whereas the Subversion checkout is just the last version of the project.</p>

<h3 id='snapshots_not_changesets'>snapshots, not changesets</h3>

<p>Unlike most other VCSs, Git is snapshot based. That is, instead of thinking about and storing commit points as file based patches or deltas, it stores it as a simple snapshot of what your project looked like when you committed.</p>

<p>Commits, then, are simply objects that contain some metadata about the commit (the message, author, date, etc), a pointer to a single snapshot of the project and pointers to the commit(s) that came directly before it. Git&#8217;s commit history and data model is really just a directed graph - a simple series of snapshots.</p>

<p><img src='../images/snapshots.png' alt='Git Data Model' /></p>

<p>Keeping this in mind is helpful when you&#8217;re thinking about what Git will do in a given situation.</p>

<p>For a more in-depth examination of how Git stores data, checkout <a href='http://eagain.net/articles/git-for-computer-scientists/'>Git for Computer Scientists</a>.</p>

<h3 id='cheap_branching_and_easy_merging'>cheap branching and easy merging</h3>

<h3 id='installing_git'>installing git</h3>

<p>See the <a href='http://book.git-scm.com/2_installing_git.html'>Git Community Book</a> for details on how to install Git on your particular operating system.</p>

<h3 id='resources'>resources</h3>

<p>For more information on Git, the homepage is at <a href='http://git-scm.com'>git-scm.com</a>.</p><br/><br/><hr/></div>
</div>

<div id="footer" class="span-21">
<div class="info span-12">
Expand Down
4 changes: 3 additions & 1 deletion p/setup.html
Expand Up @@ -41,7 +41,9 @@ <h1>Setup and Initialization</h1>
<p>Setup your Git environment, then create a new Git repository and clone an existing one.</p>
</div>

<div class="span-21"></div>
<div class="content">
<div class="span-21"></div>
</div>

<div id="footer" class="span-21">
<div class="info span-12">
Expand Down
180 changes: 179 additions & 1 deletion pages/intro.markdown
@@ -1 +1,179 @@
hello
Welcome to the first lesson of the GitHub Learning course. This course
will lead you through a series of lessons that will demonstrate how to use
Git quickly and easily - many of the lessons will have screencasts that you
can watch as well, if you learn better that way.

This chapter is about what Git is and why you should use it - just a quick
introduction before we start using it.

Git is a **fast, open source, distributed version** control system that is quickly
replacing subversion in open source and corporate programming communities.

### version control system ###

First off, Git is a _version control system_, a simple command line
tool for keeping a history on the state of your source code projects. You
use it as you might use something like Subversion, CVS or Perforce.

You tell it to track files in your project and periodically commit the state
of the project when you want a saved point. Then you can share that history
with other developers for collaboration, merge between their work and yours,
and compare or revert to previous versions of the project or individual files.

As it is primarily a command line tool, most of the examples in this course
will show the command line versions of the functions. We will be using a
recent version of Git (the 1.6 series) for the examples in this course. We
recommend upgrading to the 1.6 series if your version of Git is older - there
have been a number of UI improvements that make Git a bit easier to use.

$ git --version
git version 1.6.1.2

If you need help with any of the commands, you can type '--help' and it will
show you the _man_ page. You can also type 'git help _command_' for the same thing.

$ git log --help
$ git help log

### open source

Git is an open source project, that has been active for several years and is
written mostly in C.

![Git Language Breakdown](../images/git-lang.png)

At any time you can get the full source code to analyze or improve upon.
To get a download of the source code, visit
[git-scm.com/download](http://git-scm.com/download). Git is licensed under
the GNU General Public License.

### offline and fast

Git is fully distributed, which means that it can work almost entirely offline.
In stark contrast to VCS tools like Perforce or Subversion, Git does nearly all
of it's operations without needing a network connection, including history
viewing, difference viewing and commiting.

This also means that Git is very fast compared to those systems partially due
to the fact that none of these operations has any dependency on network latency.
For example, take a look at how fast the simple 'log' command takes to run in
Git and in Subversion.

[master]$ time git log > /dev/null

real 0m0.352s
user 0m0.300s
sys 0m0.034s

$ time svn log > /dev/null

real 0m3.709s
user 0m0.482s
sys 0m0.168s

Git at 0.3 seconds vs Subversion at 3.7 seconds. That is a difference of a
full order of magnatude. You'll find similar
differences with nearly any command comparison. For example, adding the popular
famfamfam icon set and committing them. Since you can seperate the commit from the
network 'push' in Git, this action takes a quarter of a second in Git, but 45 seconds
in Subversion.

time 'git add icons; git commit -m "added icons"'

real 0m0.273s
user 0m0.032s
sys 0m0.008s

time 'svn add icons; svn commit -m "added icons"'

real 0m45.276s
user 0m15.997s
sys 0m5.503s

Even if you needed to push to a shared repository at that time as well, it still
takes far, far less time than Subversion.

time git push

real 0m6.219s
user 0m0.023s
sys 0m0.011s

If you just want to commit and keep working, you're looking at a huge time
difference - one that severely changes your workflow.
Most commands in Git seem instantaneous - no more typing 'svn commit' and
then going for a cup of coffee.

### small (vs svn) ###

Git is also very space efficient. For example, the Django project has mirrors
in several currently popular source control systems, and of all of them, the
Git clone is the smallest.

$ du -d 1 -h
108M ./django-bzr
44M ./django-git
53M ./django-hg
53M ./django-svn

Interestingly, it is even smaller than the Subversion checkout, which is pretty
amazing, considering that the Git clone contains the entire history of the project -
every version of every file back to the first commit, whereas the Subversion
checkout is just the last version of the project.

### snapshots, not changesets

Unlike most other VCSs, Git is snapshot based. That is, instead of thinking
about and storing commit points as file based patches or deltas, it stores it
as a simple snapshot of what your project looked like when you committed.

Commits, then, are simply objects that contain some metadata about the commit
(the message, author, date, etc), a pointer to a single snapshot of the project
and pointers to the commit(s) that came directly before it. Git's commit history
and data model is really just a directed graph - a simple series of snapshots.

![Git Data Model](../images/snapshots.png)

Keeping this in mind is helpful when you're thinking about what Git will do
in a given situation.

For a more in-depth examination of how Git stores data, checkout
[Git for Computer Scientists](http://eagain.net/articles/git-for-computer-scientists/).


### cheap branching and easy merging

Probably the most compelling feature of Git, since it often fundamentally
changes the way that many developers work, is Gits branching model. Instead
of the popular VCS branching method of simply cloning into a seperate directory
for a branch, Git lets you switch between branches in a single working directory.
Add to that the fact that creating and switching between branches is nearly
instant, not all of your branches need to be shared, and it's easy to stash
partially completed work - means that the way you work can be incredibly different.

Instead of only having branches for major development line departures, Git
developers routinely create, merge and destroy multiple branches a week, or even
per day. Often each feature or bug you are working on can have its own branch,
merged in only when it is complete. This model allows you to experiment quickly,
easily and safely - without having to go through hoops to get back to where you
where. It enables and encourages a _non-linear_ development cycle, where you
can work on multiple lines of thought in parallel without them stepping on
each other.

Many developers feel that this is so incredibly helpful and has changed
their workflow and productivity so much that they dub it the
["killer feature"](http://www-cs-students.stanford.edu/~blynn/gitmagic/ch04.html)
of Git.

### installing git

See the [Git Community Book](http://book.git-scm.com/2_installing_git.html)
for details on how to install Git on your particular operating system.

### resources

For more information on Git, the homepage is at [git-scm.com](http://git-scm.com).




23 changes: 23 additions & 0 deletions scripts/1-intro.txt
@@ -0,0 +1,23 @@
welcome to the first episode of the github learning course

my name is scott chacon, and in this episode were going to learn what git is - just a quick introduction before we start using it

Git is a fast, open source, distributed version control system that is quickly
replacing subversion in open source and corporate programming communities.

# version control system
git --version
git help

# open source

# snapshots, not changesets

# offline and fast

# small (vs svn)
du -d 1 -h

# cheap branching and easy merging

# git-scm.com
26 changes: 26 additions & 0 deletions scripts/2-setup.txt
@@ -0,0 +1,26 @@
# setup

git config --global user.name
git config --global user.name
git config user.name
cat ~/.gitconfig

# init

rails
git init
ls -la
git add .
git status
git commit (vim)
git config core.editor
git log

# cloning

git clone git://github.com/schacon/munger.git
cd munger
git log

git clone http://github.com/schacon/munger.git

0 comments on commit 88b85a0

Please sign in to comment.