[from now] 2012/09/04 16:03:52

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c5e66c9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,68 @@
+# How to detect forced update or not from in Git hooks script
+
+This is a sample git pre-receive hook script for learning about how to detect forced update.
+
+## Conclusion
+
+```
+$ git rev-list oldrev ^newrev
+```
+
+## How to test
+
+```
+$ rake -T
+rake forced_push  # git hooks test detect forced update
+rake normal_push  # git hooks test
+```
+
+## Step-by-Step introduction
+
+Firstly, I describe a syntax of `[git-rev-list(1)](http://git-scm.com/docs/git-rev-list)`.
+
+In this case, we assume within a Git working repository that has this straight history.
+
+```
+   1 --- 2 --- O --- X --- 3 --- 4 --- N
+```
+
+General usage of `git-rev-list` is below.
+
+```
+$ git rev-list N
+```
+
+This command will show all of commits reachable from commit N (note: `git-rev-list` shows commits *reverse chronological order*)
+
+`git-rev-list` accepts multiple arguments.
+
+```
+$ git rev-list N O
+```
+
+This command will show same output as `git rev-list N`, because commit O is an ancestor of commit N.
+
+Then, `git-rev-list` allows you to exclude commits from output.
+
+```
+$ git rev-list N ^O
+```
+
+^O means that to exclude commits reachable from O, so this command will show N, 4, 3, X (note: O is excluded)
+
+---
+
+
+
+```
+   * --- B --- * --- O ($oldrev)
+          \
+           * --- X --- * --- N ($newrev)
+```
+
+## See Also
+
+ * [git-rev-list(1)](http://git-scm.com/docs/git-rev-list)
+ * [Git hook example: post-receive-email](http://git.gnus.org/gnus.git/hooks/post-receive-email)
+ * [git - How to detect a forced update - Stack Overflow](http://stackoverflow.com/questions/10319110/how-to-detect-a-forced-update)
+ * [githooks - Git hook to detect push --mirror - Stack Overflow](http://stackoverflow.com/questions/9210957/git-hook-to-detect-push-mirror)
[from now] 2012/09/04 16:21:09

diff --git a/README.md b/README.md
index c5e66c9..6d27ef4 100644
--- a/README.md
+++ b/README.md
@@ -52,7 +52,9 @@ $ git rev-list N ^O

 ---

+Since we are learned about `git-rev-list`, I describe a case about forced update occured.

+In this case, we assume within a Git working repository that has this complex history.

 ```
    * --- B --- * --- O ($oldrev)
@@ -60,8 +62,24 @@ $ git rev-list N ^O
            * --- X --- * --- N ($newrev)
 ```

+ 1. In old tree, we had 4 commits (*, B, *, O) and pushed them to remote.
+ 2. We checkout a new branch from commit B, it's new tree.
+ 3. In new tree, we had 4 commits (*, X, *, N) and pushed them to remote with --force option!
+
+When pushed, hook pre-receive script invoked with standard input. The format of stdin parameter is described at [githooks(5)](http://git-scm.com/docs/githooks).
+
+Typically, we extract two commit object sha1 from stdin - oldrev and newrev. oldrev is *HEAD of old tree*, newrev is *HEAD of new tree*.
+
+In this situation, we can detect forced push by `git-rev-list` output.
+
+`git rev-list oldrev ^newrev` shows the commits reachable from oldrev but not reachable from newrev. This shows the commits *existed only old tree*.
+If this command show any commits, old tree was replaced with new tree, so forced update was occured. This is what we want!
+
+If this command show none of commits, new tree was normally updated, so forced update was not occured. Simply.
+
 ## See Also

+ * [Sample git pre-receive hook script for learning about how to detect forced update](https://github.com/kyanny/git-hooks-detect-force-update)
  * [git-rev-list(1)](http://git-scm.com/docs/git-rev-list)
  * [Git hook example: post-receive-email](http://git.gnus.org/gnus.git/hooks/post-receive-email)
  * [git - How to detect a forced update - Stack Overflow](http://stackoverflow.com/questions/10319110/how-to-detect-a-forced-update)
[from now] 2012/09/04 16:22:27

diff --git a/README.md b/README.md
index 6d27ef4..d357ffa 100644
--- a/README.md
+++ b/README.md
@@ -4,17 +4,13 @@ This is a sample git pre-receive hook script for learning about how to detect fo

 ## Conclusion

-```
-$ git rev-list oldrev ^newrev
-```
+> $ git rev-list oldrev ^newrev

 ## How to test

-```
-$ rake -T
-rake forced_push  # git hooks test detect forced update
-rake normal_push  # git hooks test
-```
+> $ rake -T
+> rake forced_push  # git hooks test detect forced update
+> rake normal_push  # git hooks test

 ## Step-by-Step introduction

@@ -22,31 +18,23 @@ Firstly, I describe a syntax of `[git-rev-list(1)](http://git-scm.com/docs/git-r

 In this case, we assume within a Git working repository that has this straight history.

-```
-   1 --- 2 --- O --- X --- 3 --- 4 --- N
-```
+>   1 --- 2 --- O --- X --- 3 --- 4 --- N

 General usage of `git-rev-list` is below.

-```
-$ git rev-list N
-```
+> $ git rev-list N

 This command will show all of commits reachable from commit N (note: `git-rev-list` shows commits *reverse chronological order*)

 `git-rev-list` accepts multiple arguments.

-```
-$ git rev-list N O
-```
+> $ git rev-list N O

 This command will show same output as `git rev-list N`, because commit O is an ancestor of commit N.

 Then, `git-rev-list` allows you to exclude commits from output.

-```
-$ git rev-list N ^O
-```
+> $ git rev-list N ^O

 ^O means that to exclude commits reachable from O, so this command will show N, 4, 3, X (note: O is excluded)

@@ -56,11 +44,9 @@ Since we are learned about `git-rev-list`, I describe a case about forced update

 In this case, we assume within a Git working repository that has this complex history.

-```
-   * --- B --- * --- O ($oldrev)
-          \
-           * --- X --- * --- N ($newrev)
-```
+>   * --- B --- * --- O ($oldrev)
+>          \
+>           * --- X --- * --- N ($newrev)

  1. In old tree, we had 4 commits (*, B, *, O) and pushed them to remote.
  2. We checkout a new branch from commit B, it's new tree.
[from now] 2012/09/04 16:23:47

diff --git a/README.md b/README.md
index d357ffa..8b89ef5 100644
--- a/README.md
+++ b/README.md
@@ -4,13 +4,13 @@ This is a sample git pre-receive hook script for learning about how to detect fo

 ## Conclusion

-> $ git rev-list oldrev ^newrev
+    $ git rev-list oldrev ^newrev

 ## How to test

-> $ rake -T
-> rake forced_push  # git hooks test detect forced update
-> rake normal_push  # git hooks test
+    $ rake -T
+    rake forced_push  # git hooks test detect forced update
+    rake normal_push  # git hooks test

 ## Step-by-Step introduction

@@ -18,23 +18,23 @@ Firstly, I describe a syntax of `[git-rev-list(1)](http://git-scm.com/docs/git-r

 In this case, we assume within a Git working repository that has this straight history.

->   1 --- 2 --- O --- X --- 3 --- 4 --- N
+    1 --- 2 --- O --- X --- 3 --- 4 --- N

 General usage of `git-rev-list` is below.

-> $ git rev-list N
+    $ git rev-list N

 This command will show all of commits reachable from commit N (note: `git-rev-list` shows commits *reverse chronological order*)

 `git-rev-list` accepts multiple arguments.

-> $ git rev-list N O
+    $ git rev-list N O

 This command will show same output as `git rev-list N`, because commit O is an ancestor of commit N.

 Then, `git-rev-list` allows you to exclude commits from output.

-> $ git rev-list N ^O
+    $ git rev-list N ^O

 ^O means that to exclude commits reachable from O, so this command will show N, 4, 3, X (note: O is excluded)

@@ -44,9 +44,9 @@ Since we are learned about `git-rev-list`, I describe a case about forced update

 In this case, we assume within a Git working repository that has this complex history.

->   * --- B --- * --- O ($oldrev)
->          \
->           * --- X --- * --- N ($newrev)
+    * --- B --- * --- O ($oldrev)
+           \
+            * --- X --- * --- N ($newrev)

  1. In old tree, we had 4 commits (*, B, *, O) and pushed them to remote.
  2. We checkout a new branch from commit B, it's new tree.
[from now] 2012/09/04 16:24:27

diff --git a/README.md b/README.md
index 8b89ef5..2aae5fd 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,7 @@
 # How to detect forced update or not from in Git hooks script

+https://github.com/kyanny/git-hooks-detect-force-update
+
 This is a sample git pre-receive hook script for learning about how to detect forced update.

 ## Conclusion
@@ -65,7 +67,6 @@ If this command show none of commits, new tree was normally updated, so forced u

 ## See Also

- * [Sample git pre-receive hook script for learning about how to detect forced update](https://github.com/kyanny/git-hooks-detect-force-update)
  * [git-rev-list(1)](http://git-scm.com/docs/git-rev-list)
  * [Git hook example: post-receive-email](http://git.gnus.org/gnus.git/hooks/post-receive-email)
  * [git - How to detect a forced update - Stack Overflow](http://stackoverflow.com/questions/10319110/how-to-detect-a-forced-update)