Skip to content
This repository has been archived by the owner on Jan 3, 2018. It is now read-only.

Commit

Permalink
Modifying all raw Markdown files to use class attributes for code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
gvwilson committed Apr 24, 2014
1 parent 8bb0184 commit e2f3f3d
Show file tree
Hide file tree
Showing 19 changed files with 415 additions and 823 deletions.
9 changes: 3 additions & 6 deletions aux/blank-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@ Write paragraphs of text here.
When you need to show input, output, and errors,
use `<div ...>` and triple tildes as shown below:

<div class="in" markdown="1">
~~~
$ this is the input
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
this is the output
~~~
</div>
<div class="err" markdown="1">
{:class="out"}
~~~
error message
~~~
</div>
{:class="err"}

The `div`'s are needed because
Jekyll's Markdown processor will not let us put classes on code blocks.
Expand Down
111 changes: 37 additions & 74 deletions novice/extras/01-branching.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ title: Branching in Git
---
Here's where we are right now:

<div class="in" markdown="1">
~~~
$ git log
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
commit 005937fbe2a98fb83f0ade869025dc2636b4dad5
Author: Vlad Dracula <[email protected]>
Expand All @@ -35,7 +33,7 @@ Cold and dry, but everything is my favorite color
The two moons may be a problem for Wolfman
But the Mummy will appreciate the lack of humidity
~~~
</div>
{:class="out"}

We can draw the history of the repository like this
(we'll see in a second why there's a box called `master`):
Expand All @@ -44,26 +42,23 @@ We can draw the history of the repository like this

Let's run this command:

<div class="in" markdown="1">
~~~
$ git branch moons
~~~
</div>
{:class="in"}

It appears to do nothing,
but behind the scenes it has created a new [branch](../../gloss.html#branch) called `moons`:

<div class="in" markdown="1">
~~~
$ git branch
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
* master
moons
~~~
</div>
{:class="out"}

<img src="img/git-branching-02.svg" alt="Immediately After Creating Branch" />

Expand All @@ -76,76 +71,65 @@ They both point to the same revision right now,
but we can change that.
Let's make `moons` the active branch:

<div class="in" markdown="1">
~~~
$ git checkout moons
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
Switched to branch 'moons'
~~~
</div>
<div class="in" markdown="1">
{:class="out"}
~~~
$ git branch
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
master
* moons
~~~
</div>
{:class="out"}

<img src="img/git-branching-03.svg" alt="After Switching to Branch" />

Our file looks the same:

<div class="in" markdown="1">
~~~
$ cat mars.txt
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
Cold and dry, but everything is my favorite color
The two moons may be a problem for Wolfman
But the Mummy will appreciate the lack of humidity
~~~
</div>
{:class="out"}

because it *is* the same:
Let's add another line to it:

<div class="in" markdown="1">
~~~
$ echo "Maybe we should put the base on one of the moons instead?" >> mars.txt
~~~
</div>
{:class="in"}

and add an entirely new file:

<div class="in" markdown="1">
~~~
$ echo "Phobos is larger than Deimos" > moons.txt
$ ls
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
mars.txt moons.txt
~~~
</div>
{:class="out"}

Git now tells us that we have one changed file and one new file:

<div class="in" markdown="1">
~~~
$ git status
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
# On branch moons
# Changes not staged for commit:
Expand All @@ -160,18 +144,16 @@ $ git status
# moons.txt
no changes added to commit (use "git add" and/or "git commit -a")
~~~
</div>
{:class="out"}

Let's add and commit those changes
(the `-A` flag to `git commit` means "add everything"):

<div class="in" markdown="1">
~~~
$ git add -A
$ git status
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
# On branch moons
# Changes to be committed:
Expand All @@ -181,19 +163,17 @@ $ git status
# new file: moons.txt
#
~~~
</div>
<div class="in" markdown="1">
{:class="out"}
~~~
$ git commit -m "Thinking about the moons"
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
[moons 62e7791] Thinking about the moons
2 files changed, 2 insertions(+)
create mode 100644 moons.txt
~~~
</div>
{:class="out"}

Our repository is now in the state shown below:

Expand All @@ -203,36 +183,31 @@ The `moons` branch has advanced to record the changes we just made,
but `master` is still where it was.
If we switch back to `master`:

<div class="in" markdown="1">
~~~
$ git checkout master
~~~
</div>
{:class="in"}

our changes seem to disappear:

<div class="in" markdown="1">
~~~
$ ls
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
mars.txt
~~~
</div>
<div class="in" markdown="1">
{:class="out"}
~~~
$ cat mars.txt
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
Cold and dry, but everything is my favorite color
The two moons may be a problem for Wolfman
But the Mummy will appreciate the lack of humidity
~~~
</div>
{:class="out"}

They're still in the repository&mdash;they're just not in
the revision that `master` is currently pointing to.
Expand All @@ -241,13 +216,11 @@ we've created a parallel timeline that shares some history with the original one

Let's make some changes in the `master` branch to further illustrate this point:

<div class="in" markdown="1">
~~~
$ echo "Should we go with a classical name like Ares Base?" > names.txt
$ git status
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
# On branch master
# Untracked files:
Expand All @@ -256,20 +229,18 @@ $ git status
# names.txt
nothing added to commit but untracked files present (use "git add" to track)
~~~
</div>
<div class="in" markdown="1">
{:class="out"}
~~~
$ git add names.txt
$ git commit -m "We will need a cool name for our secret base"
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
[master dfcf908] We will need a cool name for our secret base
1 file changed, 1 insertion(+)
create mode 100644 names.txt
~~~
</div>
{:class="out"}

Our repository is now in this state:

Expand All @@ -281,22 +252,19 @@ They could continue independent existence indefinitely,
but at some point we'll probably want to [merge](../../gloss.html#merge) our changes.
Let's do that now:

<div class="in" markdown="1">
~~~
$ git branch
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
* master
moons
~~~
</div>
<div class="in" markdown="1">
{:class="out"}
~~~
$ git merge moons
~~~
</div>
{:class="in"}

When we run the `git merge` command,
Git opens an editor to let us write a log entry about what we're doing.
Expand All @@ -323,41 +291,36 @@ In this case,
we'll stick with the default log message.
When we save the file and exit the editor, Git displays this:

<div class="out" markdown="1">
~~~
Merge made by the 'recursive' strategy.
mars.txt | 1 +
moons.txt | 1 +
2 files changed, 2 insertions(+)
create mode 100644 moons.txt
~~~
</div>
{:class="out"}

We now have all of our changes in one place:

<div class="in" markdown="1">
~~~
$ ls
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
mars.txt moons.txt names.txt
~~~
</div>
{:class="out"}

and our repository looks like this:

<img src="img/git-branching-06.svg" alt="After Merging" />

We can ask Git to draw a diagram of the repository's history with this command:

<div class="in" markdown="1">
~~~
$ git log --oneline --topo-order --graph
~~~
</div>
<div class="out" markdown="1">
{:class="in"}
~~~
* e0cf8ab Merge branch 'moons'
|\
Expand All @@ -368,7 +331,7 @@ $ git log --oneline --topo-order --graph
* 34961b1 Concerns about Mars's moons on my furry friend
* f22b25e Starting to think about Mars
~~~
</div>
{:class="out"}

This ASCII art is fine for small sets of changes,
but for anything significant,
Expand Down
Loading

0 comments on commit e2f3f3d

Please sign in to comment.