quizzes/git: Add 'git commit --amend' question
[quizzer.git] / quizzes / git.json
1 {
2         "version": "0.1",
3         "questions": [
4                 {
5                         "class": "ScriptQuestion",
6                         "interpreter": "sh",
7                         "id": "git config --global user.name",
8                         "prompt": "configure your user-wide name to be `A U Thor`",
9                         "answer": "git config --global user.name 'A U Thor'",
10                         "setup": [
11                                         "export HOME=."
12                                         ],
13                         "teardown": [
14                                 "cat .gitconfig"
15                                 ],
16                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-config.html"
17                 },
18                 {
19                         "class": "ScriptQuestion",
20                         "interpreter": "sh",
21                         "id": "git config --global user.email",
22                         "prompt": "configure your user-wide email to be `author@example.com`",
23                         "answer": "git config --global user.email 'author@example.com'",
24                         "setup": [
25                                         "export HOME=."
26                                         ],
27                         "teardown": [
28                                 "cat .gitconfig"
29                                 ],
30                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-config.html"
31                 },
32                 {
33                         "class": "ScriptQuestion",
34                         "interpreter": "sh",
35                         "id": "git init",
36                         "prompt": "initialize a Git repository in a new `my-project` directory",
37                         "multiline": true,
38                         "answer": [
39                                         "mkdir my-project",
40                                         "cd my-project",
41                                         "git init"
42                                         ],
43                         "teardown": [
44                                 "git status"
45                                 ],
46                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-init.html"
47                 },
48                 {
49                         "class": "ScriptQuestion",
50                         "interpreter": "sh",
51                         "id": "git clone",
52                         "prompt": "clone git://github.com/wking/quizzer.git into a new `quizzer` directory",
53                         "answer": "git clone git://github.com/wking/quizzer.git",
54                         "teardown": [
55                                 "cd quizzer",
56                                 "git status"
57                                 ],
58                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-clone.html"
59                 },
60                 {
61                         "class": "ScriptQuestion",
62                         "interpreter": "sh",
63                         "id": "git add / commit",
64                         "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`",
65                         "multiline": true,
66                         "timeout": null,
67                         "answer": [
68                                 "git add README",
69                                 "git commit -m \"Add a README\""
70                                 ],
71                         "setup": [
72                                 "export GIT_AUTHOR_NAME='A U Thor'",
73                                 "export GIT_AUTHOR_EMAIL=author@example.com",
74                                 "export GIT_COMMITTER_NAME='C O Mitter'",
75                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
76                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
77                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
78                                 "git init",
79                                 "echo 'This project is wonderful' > README"
80                                 ],
81                         "teardown": [
82                                 "git ls-files",
83                                 "git status"
84                                 ],
85                         "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"
86                 },
87                 {
88                         "class": "ScriptQuestion",
89                         "interpreter": "sh",
90                         "id": "git checkout HEAD -- FILE",
91                         "prompt": "you've messed up your README file.\nrestore it to the last committed version",
92                         "answer": "git checkout HEAD -- README",
93                         "setup": [
94                                 "export GIT_AUTHOR_NAME='A U Thor'",
95                                 "export GIT_AUTHOR_EMAIL=author@example.com",
96                                 "export GIT_COMMITTER_NAME='C O Mitter'",
97                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
98                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
99                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
100                                 "git init",
101                                 "echo 'This project is wonderful' > README",
102                                 "git add README",
103                                 "git commit -am 'Add a README'",
104                                 "echo 'This project is terrible' > README"
105                                 ],
106                         "teardown": [
107                                 "git status",
108                                 "cat README"
109                                 ],
110                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html"
111                 },
112                 {
113                         "class": "ScriptQuestion",
114                         "interpreter": "sh",
115                         "id": "git commit --amend",
116                         "prompt": "you messed up your README file in your last commit.\nyou just fixed the contents of `README`, but haven't added it to the index.\ncommit the new version so it also fixes the last commit.\nthe fixed commit message should be `Add a README`.",
117                         "multiline": true,
118                         "timeout": null,
119                         "answer": [
120                                 "git commit --amend -am 'Add a README'"
121                                 ],
122                         "setup": [
123                                 "export GIT_AUTHOR_NAME='A U Thor'",
124                                 "export GIT_AUTHOR_EMAIL=author@example.com",
125                                 "export GIT_COMMITTER_NAME='C O Mitter'",
126                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
127                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
128                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
129                                 "git init",
130                                 "echo 'This project is terrible' > README",
131                                 "git add README",
132                                 "git commit -am 'Add a README'",
133                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
134                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
135                                 "echo 'This project is wonderful' > README"
136                                 ],
137                         "teardown": [
138                                 "git log -p",
139                                 "git status"
140                                 ],
141                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html"
142                 }
143         ]
144 }