quizzes/git: Add 'git checkout HEAD -- FILE' question
[quizzer.git] / quizzes / git.json
1 {
2         "version": "0.1",
3         "questions": [
4                 {
5                         "class": "ScriptQuestion",
6                         "interpreter": "sh",
7                         "id": "git init",
8                         "prompt": "initialize a Git repository in a new `my-project` directory",
9                         "multiline": true,
10                         "answer": [
11                                         "mkdir my-project",
12                                         "cd my-project",
13                                         "git init"
14                                         ],
15                         "teardown": [
16                                 "git status"
17                                 ],
18                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-init.html"
19                 },
20                 {
21                         "class": "ScriptQuestion",
22                         "interpreter": "sh",
23                         "id": "git clone",
24                         "prompt": "clone git://github.com/wking/quizzer.git into a new `quizzer` directory",
25                         "answer": "git clone git://github.com/wking/quizzer.git",
26                         "teardown": [
27                                 "cd quizzer",
28                                 "git status"
29                                 ],
30                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-clone.html"
31                 },
32                 {
33                         "class": "ScriptQuestion",
34                         "interpreter": "sh",
35                         "id": "git add / commit",
36                         "prompt": "there is a new README file in your repository.\nmake a new commit including this README.\nthe commit message should be `Add a README`",
37                         "multiline": true,
38                         "timeout": null,
39                         "answer": [
40                                 "git add README",
41                                 "git commit -m \"Add a README\""
42                                 ],
43                         "setup": [
44                                 "export GIT_AUTHOR_NAME='A U Thor'",
45                                 "export GIT_AUTHOR_EMAIL=author@example.com",
46                                 "export GIT_COMMITTER_NAME='C O Mitter'",
47                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
48                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
49                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
50                                 "git init",
51                                 "echo 'This project is wonderful' > README"
52                                 ],
53                         "teardown": [
54                                 "git ls-files",
55                                 "git status"
56                                 ],
57                         "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"
58                 },
59                 {
60                         "class": "ScriptQuestion",
61                         "interpreter": "sh",
62                         "id": "git checkout HEAD -- FILE",
63                         "prompt": "you've messed up your README file.\nrestore it to the last committed version",
64                         "answer": "git checkout HEAD -- README",
65                         "setup": [
66                                 "export GIT_AUTHOR_NAME='A U Thor'",
67                                 "export GIT_AUTHOR_EMAIL=author@example.com",
68                                 "export GIT_COMMITTER_NAME='C O Mitter'",
69                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
70                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
71                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
72                                 "git init",
73                                 "echo 'This project is wonderful' > README",
74                                 "git add README",
75                                 "git commit -am 'Add a README'",
76                                 "echo 'This project is terrible' > README"
77                                 ],
78                         "teardown": [
79                                 "git status",
80                                 "cat README"
81                                 ],
82                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"
83                 }
84         ]
85 }