quizzes/git: Add 'git checkout HEAD -- FILE' question
authorW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 02:43:06 +0000 (21:43 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 6 Feb 2013 02:58:30 +0000 (21:58 -0500)
quizzes/git.json

index 5d547902d36d97d77c341404cba5fdece3ac3aaa..364e3d57801e3e50b61a7ba95cdf99b121ee381a 100644 (file)
                                "git status"
                                ],
                        "help": "http://www.kernel.org/pub/software/scm/git/docs/git-add.html\nhttp://www.kernel.org/pub/software/scm/git/docs/git-commit.html"
+               },
+               {
+                       "class": "ScriptQuestion",
+                       "interpreter": "sh",
+                       "id": "git checkout HEAD -- FILE",
+                       "prompt": "you've messed up your README file.\nrestore it to the last committed version",
+                       "answer": "git checkout HEAD -- README",
+                       "setup": [
+                               "export GIT_AUTHOR_NAME='A U Thor'",
+                               "export GIT_AUTHOR_EMAIL=author@example.com",
+                               "export GIT_COMMITTER_NAME='C O Mitter'",
+                               "export GIT_COMMITTER_EMAIL=committer@example.com",
+                               "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
+                               "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
+                               "git init",
+                               "echo 'This project is wonderful' > README",
+                               "git add README",
+                               "git commit -am 'Add a README'",
+                               "echo 'This project is terrible' > README"
+                               ],
+                       "teardown": [
+                               "git status",
+                               "cat README"
+                               ],
+                       "help": "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"
                }
        ]
 }