Skip to content

Instantly share code, notes, and snippets.

@waylan
Created November 9, 2012 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waylan/4048183 to your computer and use it in GitHub Desktop.
Save waylan/4048183 to your computer and use it in GitHub Desktop.
Bash session testing the creation of a git repo and using subtree to extract the /docs dir as the gh-pages branch.
waylan@dev:~$ mkdir foo
waylan@dev:~$ cd foo
waylan@dev:~/foo$ git init
Initialized empty Git repository in /home/waylan/foo/.git/
waylan@dev:~/foo$ echo "foo" > README
waylan@dev:~/foo$ git add README
waylan@dev:~/foo$ git commit -m 'Added README'
[master (root-commit) 1f31bb3] Added README
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 README
waylan@dev:~/foo$ mkdir src
waylan@dev:~/foo$ touch src/foo
waylan@dev:~/foo$ git add src/
waylan@dev:~/foo$ git commit -m "Added src/foo"
[master 40003b8] Added src/foo
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 src/foo
waylan@dev:~/foo$ mkdir docs
waylan@dev:~/foo$ touch docs/index.html
waylan@dev:~/foo$ git add docs/
waylan@dev:~/foo$ git commit -m "Added docs/"
[master 19d7b71] Added docs/
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 docs/index.html
waylan@dev:~/foo$ echo "<h1>Foo</h1>" > docs/index.html
waylan@dev:~/foo$ git add docs/
waylan@dev:~/foo$ git commit -m "Added content to docs/index.html"
[master 4b64072] Added content to docs/index.html
1 files changed, 1 insertions(+), 0 deletions(-)
waylan@dev:~/foo$ git subtree split --branch gh-pages --prefix docs/
Created branch 'gh-pages'
ab8eb66a6770438b45505390a30232f9d50919a0
waylan@dev:~/foo$ git branch
gh-pages
* master
waylan@dev:~/foo$ ls
docs README src
waylan@dev:~/foo$ git log
commit 4b6407252fc6b988de3b065bf60b211cac40cdb3
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:31:22 2012 -0500
Added content to docs/index.html
commit 19d7b718c1e9f36495198c92bb6444560e3d375b
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:29:33 2012 -0500
Added docs/
commit 40003b8bd67d338a4fa281f32ec74e02aa50b9b5
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:28:13 2012 -0500
Added src/foo
commit 1f31bb3423fa1791b1a22afa4ae63844028fd26f
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:26:49 2012 -0500
Added README
waylan@dev:~/foo$ git checkout gh-pages
Switched to branch 'gh-pages'
waylan@dev:~/foo$ ls
index.html
waylan@dev:~/foo$ git log
commit ab8eb66a6770438b45505390a30232f9d50919a0
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:31:22 2012 -0500
Added content to docs/index.html
commit 29de5d80e1cc4c8510f8ccbb4c5c55504fe26181
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:29:33 2012 -0500
Added docs/
waylan@dev:~/foo$ git checkout master
Switched to branch 'master'
waylan@dev:~/foo$ ls
docs README src
waylan@dev:~/foo$ echo "<h1>Foo</h1><p>bar</p>" > docs/index.html
waylan@dev:~/foo$ git add docs/
waylan@dev:~/foo$ git commit -m "Added more docs content."
[master 23ea643] Added morw docs content.
1 files changed, 1 insertions(+), 1 deletions(-)
waylan@dev:~/foo$ git subtree split --branch gh-pages --prefix docs/
Updated branch 'gh-pages'
d482d07108f23728cea4fe17699d0437648c433a
waylan@dev:~/foo$ git checkout gh-pages
Switched to branch 'gh-pages'
waylan@dev:~/foo$ git log
commit d482d07108f23728cea4fe17699d0437648c433a
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:45:26 2012 -0500
Added more docs content.
commit ab8eb66a6770438b45505390a30232f9d50919a0
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:31:22 2012 -0500
Added content to docs/index.html
commit 29de5d80e1cc4c8510f8ccbb4c5c55504fe26181
Author: Waylan Limberg <waylan@gmail.com>
Date: Tue Nov 6 10:29:33 2012 -0500
Added docs/
waylan@dev:~/foo$ cat index.html
<h1>Foo</h1><p>bar</p>
waylan@dev:~/foo$ git checkout master
Switched to branch 'master'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment