quizzes/git: Add 'git branch *' questions
[quizzer.git] / quizzes / git.json
1 {
2         "version": "0.1",
3         "questions": [
4                 {
5                         "class": "ScriptQuestion",
6                         "intepreter": "sh",
7                         "id": "git help config",
8                         "prompt": "Get help for Git's `config` command",
9                         "answer": "git help config",
10                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-help.html",
11                         "tags": [
12                                 "help"
13                                 ]
14                 },
15                 {
16                         "class": "ScriptQuestion",
17                         "interpreter": "sh",
18                         "id": "git config --global user.name",
19                         "prompt": "Configure your user-wide name to be `A U Thor`.",
20                         "answer": "git config --global user.name 'A U Thor'",
21                         "setup": [
22                                         "export HOME=."
23                                         ],
24                         "teardown": [
25                                 "cat .gitconfig"
26                                 ],
27                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-config.html",
28                         "tags": [
29                                 "config"
30                                 ]
31                 },
32                 {
33                         "class": "ScriptQuestion",
34                         "interpreter": "sh",
35                         "id": "git config --global user.email",
36                         "prompt": "Configure your user-wide email to be `author@example.com`.",
37                         "answer": "git config --global user.email 'author@example.com'",
38                         "setup": [
39                                         "export HOME=."
40                                         ],
41                         "teardown": [
42                                 "cat .gitconfig"
43                                 ],
44                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-config.html",
45                         "tags": [
46                                 "config"
47                                 ]
48                 },
49                 {
50                         "class": "ScriptQuestion",
51                         "interpreter": "sh",
52                         "id": "git init",
53                         "prompt": "Initialize a Git repository in a new `my-project` directory.",
54                         "multiline": true,
55                         "answer": [
56                                         "mkdir my-project",
57                                         "cd my-project",
58                                         "git init"
59                                         ],
60                         "teardown": [
61                                 "git status"
62                                 ],
63                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-init.html",
64                         "tags": [
65                                 "init"
66                                 ]
67                 },
68                 {
69                         "class": "ScriptQuestion",
70                         "interpreter": "sh",
71                         "id": "git clone",
72                         "prompt": "Clone git://github.com/wking/quizzer.git into a new `quizzer` directory.",
73                         "answer": "git clone git://github.com/wking/quizzer.git",
74                         "teardown": [
75                                 "cd quizzer",
76                                 "git status"
77                                 ],
78                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-clone.html",
79                         "tags": [
80                                 "init"
81                                 ]
82                 },
83                 {
84                         "class": "ScriptQuestion",
85                         "interpreter": "sh",
86                         "id": "git add / commit",
87                         "prompt": [
88                                 "There is a new README file in your repository.",
89                                 "Make a new commit including this README.",
90                                 "The commit message should be `Add a README`."
91                                 ],
92                         "multiline": true,
93                         "timeout": null,
94                         "answer": [
95                                 "git add README",
96                                 "git commit -m 'Add a README'"
97                                 ],
98                         "setup": [
99                                 "export GIT_AUTHOR_NAME='A U Thor'",
100                                 "export GIT_AUTHOR_EMAIL=author@example.com",
101                                 "export GIT_COMMITTER_NAME='C O Mitter'",
102                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
103                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
104                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
105                                 "git init",
106                                 "echo 'This project is wonderful' > README"
107                                 ],
108                         "teardown": [
109                                 "git ls-files",
110                                 "git status"
111                                 ],
112                         "help": [
113                                 "http://www.kernel.org/pub/software/scm/git/docs/git-add.html",
114                                 "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html"
115                                 ],
116                         "tags": [
117                                 "add",
118                                 "commit"
119                                 ]
120                 },
121                 {
122                         "class": "ScriptQuestion",
123                         "interpreter": "sh",
124                         "id": "git status",
125                         "prompt": [
126                                 "You don't remember if you've staged README to be committed.",
127                                 "How would you check?"
128                                 ],
129                         "answer": "git status",
130                         "setup": [
131                                 "git init",
132                                 "echo 'This project is wonderful' > README",
133                                 "git add README"
134                                 ],
135                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-status.html",
136                         "tags": [
137                                 "add",
138                                 "query"
139                                 ]
140                 },
141                 {
142                         "class": "ScriptQuestion",
143                         "interpreter": "sh",
144                         "id": "git commit -a",
145                         "prompt": [
146                                 "You've edited a few files since the last commit.",
147                                 "Make a new commit including all of these changes.",
148                                 "The commit message should be `Reformat widgets`."
149                                 ],
150                         "timeout": null,
151                         "answer": "git commit -am 'Reformat widgets'",
152                         "setup": [
153                                 "export GIT_AUTHOR_NAME='A U Thor'",
154                                 "export GIT_AUTHOR_EMAIL=author@example.com",
155                                 "export GIT_COMMITTER_NAME='C O Mitter'",
156                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
157                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
158                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
159                                 "git init",
160                                 "echo 'This project is wonderful' > README",
161                                 "echo 'Lots of widgets' > widgets",
162                                 "git add README widgets",
163                                 "git commit -m 'Add some widgets'",
164                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
165                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
166                                 "echo 'Take a look in the widgets file.' >> README",
167                                 "echo 'Widget-1 should be blue' >> widgets"
168                                 ],
169                         "teardown": [
170                                 "git log -p"
171                                 ],
172                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html",
173                         "tags": [
174                                 "commit"
175                                 ]
176                 },
177                 {
178                         "class": "ScriptQuestion",
179                         "interpreter": "sh",
180                         "id": "git rm / commit",
181                         "prompt": [
182                                 "You've had a `widgets` file in your repository for a few commits,",
183                                 "but you don't need it any more.",
184                                 "Create a commit removing the file.",
185                                 "The commit message should be `Remove 'widgets'`."
186                                 ],
187                         "multiline": true,
188                         "timeout": null,
189                         "answer": [
190                                 "git rm widgets",
191                                 "git commit -am \"Remove 'widgets'\""
192                                 ],
193                         "setup": [
194                                 "export GIT_AUTHOR_NAME='A U Thor'",
195                                         "export GIT_AUTHOR_EMAIL=author@example.com",
196                                 "export GIT_COMMITTER_NAME='C O Mitter'",
197                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
198                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
199                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
200                                 "git init",
201                                 "echo 'Lots of widgets' > widgets",
202                                 "git add widgets",
203                                 "git commit -m 'Add some widgets'",
204                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
205                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\""
206                                 ],
207                         "teardown": [
208                                 "git log -p"
209                                 ],
210                         "help": [
211                                 "http://www.kernel.org/pub/software/scm/git/docs/git-rm.html",
212                                 "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html"
213                                 ],
214                         "tags": [
215                                 "remove",
216                                 "commit"
217                                 ]
218                 },
219                 {
220                         "class": "ScriptQuestion",
221                         "interpreter": "sh",
222                         "id": "git diff",
223                         "prompt": [
224                                 "You've edited a few files since the last commit.",
225                                 "Ask Git to display the changes you've make (but not staged)."
226                                 ],
227                         "answer": "git diff",
228                         "setup": [
229                                 "export GIT_AUTHOR_NAME='A U Thor'",
230                                 "export GIT_AUTHOR_EMAIL=author@example.com",
231                                 "export GIT_COMMITTER_NAME='C O Mitter'",
232                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
233                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
234                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
235                                 "git init",
236                                 "echo 'This project is wonderful' > README",
237                                 "echo 'Lots of widgets' > widgets",
238                                 "git add README widgets",
239                                 "git commit -m 'Add some widgets'",
240                                 "echo 'Take a look in the widgets file.' >> README",
241                                 "echo 'Widget-1 should be blue' >> widgets"
242                                 ],
243                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
244                         "tags": [
245                                 "query"
246                                 ]
247                 },
248                 {
249                         "class": "ScriptQuestion",
250                         "interpreter": "sh",
251                         "id": "git diff HEAD --",
252                         "prompt": [
253                                 "You've edited a few files since the last commit.",
254                                 "Ask Git to display the changes you've make since the last commit,",
255                                 "including any changes that you may have already staged."
256                                 ],
257                         "answer": "git diff HEAD --",
258                         "setup": [
259                                 "export GIT_AUTHOR_NAME='A U Thor'",
260                                 "export GIT_AUTHOR_EMAIL=author@example.com",
261                                 "export GIT_COMMITTER_NAME='C O Mitter'",
262                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
263                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
264                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
265                                 "git init",
266                                 "echo 'This project is wonderful' > README",
267                                 "echo 'Lots of widgets' > widgets",
268                                 "git add README widgets",
269                                 "git commit -m 'Add some widgets'",
270                                 "echo 'Take a look in the widgets file.' >> README",
271                                 "echo 'Widget-1 should be blue' >> widgets",
272                                 "git add README"
273                                 ],
274                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
275                         "tags": [
276                                 "query"
277                                 ]
278                 },
279                 {
280                         "class": "ScriptQuestion",
281                         "interpreter": "sh",
282                         "id": "git diff HEAD -- README",
283                         "prompt": [
284                                 "You've edited a few files since the last commit.",
285                                 "Ask Git to display the changes you've make to README since the last commit,",
286                                 "including any changes that you may have already staged."
287                                 ],
288                         "answer": "git diff HEAD -- README",
289                         "setup": [
290                                 "export GIT_AUTHOR_NAME='A U Thor'",
291                                 "export GIT_AUTHOR_EMAIL=author@example.com",
292                                 "export GIT_COMMITTER_NAME='C O Mitter'",
293                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
294                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
295                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
296                                 "git init",
297                                 "echo 'This project is wonderful' > README",
298                                 "echo 'Lots of widgets' > widgets",
299                                 "git add README widgets",
300                                 "git commit -m 'Add some widgets'",
301                                 "echo 'Take a look in the widgets file.' >> README",
302                                 "echo 'Widget-1 should be blue' >> widgets",
303                                 "git add README"
304                                 ],
305                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
306                         "tags": [
307                                 "query"
308                                 ]
309                 },
310                 {
311                         "class": "ScriptQuestion",
312                         "interpreter": "sh",
313                         "id": "git diff --cached",
314                         "prompt": [
315                                 "You've edited a few files since the last commit, and staged some of them.",
316                                 "Ask Git to display only the changes you've staged."
317                                 ],
318                         "answer": "git diff --cached",
319                         "setup": [
320                                 "export GIT_AUTHOR_NAME='A U Thor'",
321                                 "export GIT_AUTHOR_EMAIL=author@example.com",
322                                 "export GIT_COMMITTER_NAME='C O Mitter'",
323                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
324                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
325                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
326                                 "git init",
327                                 "echo 'This project is wonderful' > README",
328                                 "echo 'Lots of widgets' > widgets",
329                                 "git add README widgets",
330                                 "git commit -m 'Add some widgets'",
331                                 "echo 'Take a look in the widgets file.' >> README",
332                                 "echo 'Widget-1 should be blue' >> widgets",
333                                 "git add README"
334                                 ],
335                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html",
336                         "tags": [
337                                 "query"
338                                 ]
339                 },
340                 {
341                         "class": "ScriptQuestion",
342                         "interpreter": "sh",
343                         "id": "git log",
344                         "prompt": "Print the commits leading up to your current state.",
345                         "answer": "git log",
346                         "setup": [
347                                 "export GIT_AUTHOR_NAME='A U Thor'",
348                                 "export GIT_AUTHOR_EMAIL=author@example.com",
349                                 "export GIT_COMMITTER_NAME='C O Mitter'",
350                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
351                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
352                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
353                                 "git init",
354                                 "echo 'This project is wonderful' > README",
355                                 "echo 'Lots of widgets' > widgets",
356                                 "git add README widgets",
357                                 "git commit -m 'Add some widgets'",
358                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
359                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
360                                 "echo 'Take a look in the widgets file.' >> README",
361                                 "echo 'Widget-1 should be blue' >> widgets",
362                                 "git commit -am 'More widgets'"
363                                 ],
364                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
365                         "tags": [
366                                 "query"
367                                 ]
368                 },
369                 {
370                         "class": "ScriptQuestion",
371                         "interpreter": "sh",
372                         "id": "git log -p",
373                         "prompt": [
374                                 "Print the commits leading up to your current state,",
375                                 "showing a patch for each commit."
376                                 ],
377                         "answer": "git log -p",
378                         "setup": [
379                                 "export GIT_AUTHOR_NAME='A U Thor'",
380                                 "export GIT_AUTHOR_EMAIL=author@example.com",
381                                 "export GIT_COMMITTER_NAME='C O Mitter'",
382                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
383                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
384                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
385                                 "git init",
386                                 "echo 'This project is wonderful' > README",
387                                 "echo 'Lots of widgets' > widgets",
388                                 "git add README widgets",
389                                 "git commit -m 'Add some widgets'",
390                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
391                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
392                                 "echo 'Take a look in the widgets file.' >> README",
393                                 "echo 'Widget-1 should be blue' >> widgets",
394                                 "git commit -am 'More widgets'"
395                                 ],
396                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
397                         "tags": [
398                                 "query"
399                                 ]
400                 },
401                 {
402                         "class": "ScriptQuestion",
403                         "interpreter": "sh",
404                         "id": "git log --stat",
405                         "prompt": [
406                                 "Print the commits leading up to your current state,",
407                                 "showing the files changed by each commit."
408                                 ],
409                         "answer": "git log --stat",
410                         "setup": [
411                                 "export GIT_AUTHOR_NAME='A U Thor'",
412                                 "export GIT_AUTHOR_EMAIL=author@example.com",
413                                 "export GIT_COMMITTER_NAME='C O Mitter'",
414                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
415                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
416                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
417                                 "git init",
418                                 "echo 'This project is wonderful' > README",
419                                 "echo 'Lots of widgets' > widgets",
420                                 "git add README widgets",
421                                 "git commit -m 'Add some widgets'",
422                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
423                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
424                                 "echo 'Take a look in the widgets file.' >> README",
425                                 "echo 'Widget-1 should be blue' >> widgets",
426                                 "git commit -am 'More widgets'"
427                                 ],
428                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
429                         "tags": [
430                                 "query"
431                                 ]
432                 },
433                 {
434                         "class": "ScriptQuestion",
435                         "interpreter": "sh",
436                         "id": "git log --all",
437                         "prompt": [
438                                 "Print every commit in your repository reachable from a reference",
439                                 "(e.g from any tag or branch)"
440                                 ],
441                         "answer": "git log --all",
442                         "setup": [
443                                 "export GIT_AUTHOR_NAME='A U Thor'",
444                                 "export GIT_AUTHOR_EMAIL=author@example.com",
445                                 "export GIT_COMMITTER_NAME='C O Mitter'",
446                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
447                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
448                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
449                                 "git init",
450                                 "echo 'This project is wonderful' > README",
451                                 "echo 'Lots of widgets' > widgets",
452                                 "git add README widgets",
453                                 "git commit -m 'Add some widgets'",
454                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
455                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
456                                 "git checkout -b more-widgets",
457                                 "echo 'Take a look in the widgets file.' >> README",
458                                 "echo 'Widget-1 should be blue' >> widgets",
459                                 "git commit -am 'More widgets'",
460                                 "git checkout master"
461                                 ],
462                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
463                         "tags": [
464                                 "query",
465                                 "branch"
466                                 ]
467                 },
468                 {
469                         "class": "ScriptQuestion",
470                         "interpreter": "sh",
471                         "id": "git log --oneline",
472                         "prompt": [
473                                 "Print the commits leading up to your current state,",
474                                 "with each commit only using a single line."
475                                 ],
476                         "answer": "git log --oneline",
477                         "setup": [
478                                 "export GIT_AUTHOR_NAME='A U Thor'",
479                                 "export GIT_AUTHOR_EMAIL=author@example.com",
480                                 "export GIT_COMMITTER_NAME='C O Mitter'",
481                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
482                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
483                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
484                                 "git init",
485                                 "echo 'This project is wonderful' > README",
486                                 "echo 'Lots of widgets' > widgets",
487                                 "git add README widgets",
488                                 "git commit -m 'Add some widgets'",
489                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
490                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
491                                 "echo 'Take a look in the widgets file.' >> README",
492                                 "echo 'Widget-1 should be blue' >> widgets",
493                                 "git commit -am 'More widgets'"
494                                 ],
495                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
496                         "tags": [
497                                 "query"
498                                 ]
499                 },
500                 {
501                         "class": "ScriptQuestion",
502                         "interpreter": "sh",
503                         "id": "git log --oneline --graph",
504                         "prompt": [
505                                 "Print the commits leading up to your current state,",
506                                 "with each commit only using a single line",
507                                 "and an ASCII-art inheritence graph."
508                                 ],
509                         "answer": "git log --oneline --graph",
510                         "setup": [
511                                 "export GIT_AUTHOR_NAME='A U Thor'",
512                                 "export GIT_AUTHOR_EMAIL=author@example.com",
513                                 "export GIT_COMMITTER_NAME='C O Mitter'",
514                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
515                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
516                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
517                                 "git init",
518                                 "echo 'This project is wonderful' > README",
519                                 "echo 'Lots of widgets' > widgets",
520                                 "git add README widgets",
521                                 "git commit -m 'Add some widgets'",
522                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
523                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
524                                 "echo 'Take a look in the widgets file.' >> README",
525                                 "echo 'Widget-1 should be blue' >> widgets",
526                                 "git commit -am 'More widgets'"
527                                 ],
528                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
529                         "tags": [
530                                 "query"
531                                 ]
532                 },
533                 {
534                         "class": "ScriptQuestion",
535                         "interpreter": "sh",
536                         "id": "git log --oneline --decorate",
537                         "prompt": [
538                                 "Print the commits leading up to your current state,",
539                                 "with each commit only using a single line",
540                                 "and reference (e.g. tag and branch) names before the summary"
541                                 ],
542                         "answer": "git log --oneline --decorate",
543                         "setup": [
544                                 "export GIT_AUTHOR_NAME='A U Thor'",
545                                 "export GIT_AUTHOR_EMAIL=author@example.com",
546                                 "export GIT_COMMITTER_NAME='C O Mitter'",
547                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
548                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
549                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
550                                 "git init",
551                                 "echo 'This project is wonderful' > README",
552                                 "echo 'Lots of widgets' > widgets",
553                                 "git add README widgets",
554                                 "git commit -m 'Add some widgets'",
555                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
556                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
557                                 "echo 'Take a look in the widgets file.' >> README",
558                                 "echo 'Widget-1 should be blue' >> widgets",
559                                 "git commit -am 'More widgets'"
560                                 ],
561                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html",
562                         "tags": [
563                                 "query",
564                                 "branch"
565                                 ]
566                 },
567                 {
568                         "class": "ScriptQuestion",
569                         "interpreter": "sh",
570                         "id": "git checkout HEAD -- FILE",
571                         "prompt": [
572                                 "You've messed up your README file.",
573                                 "Restore it to the last committed version."
574                                 ],
575                         "answer": "git checkout HEAD -- README",
576                         "setup": [
577                                 "export GIT_AUTHOR_NAME='A U Thor'",
578                                 "export GIT_AUTHOR_EMAIL=author@example.com",
579                                 "export GIT_COMMITTER_NAME='C O Mitter'",
580                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
581                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
582                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
583                                 "git init",
584                                 "echo 'This project is wonderful' > README",
585                                 "git add README",
586                                 "git commit -am 'Add a README'",
587                                 "echo 'This project is terrible' > README"
588                                 ],
589                         "teardown": [
590                                 "git status",
591                                 "cat README"
592                                 ],
593                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html",
594                         "tags": [
595                                 "checkout"
596                                 ]
597                 },
598                 {
599                         "class": "ScriptQuestion",
600                         "interpreter": "sh",
601                         "id": "git commit --amend",
602                         "prompt": [
603                                 "You messed up your README file in your last commit.",
604                                 "You just fixed the contents of `README`, but haven't added it to the index.",
605                                 "Commit the new version so it also fixes the last commit.",
606                                 "The fixed commit message should be `Add a README`."
607                                 ],
608                         "multiline": true,
609                         "timeout": null,
610                         "answer": [
611                                 "git commit --amend -am 'Add a README'"
612                                 ],
613                         "setup": [
614                                 "export GIT_AUTHOR_NAME='A U Thor'",
615                                 "export GIT_AUTHOR_EMAIL=author@example.com",
616                                 "export GIT_COMMITTER_NAME='C O Mitter'",
617                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
618                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
619                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
620                                 "git init",
621                                 "echo 'This project is terrible' > README",
622                                 "git add README",
623                                 "git commit -am 'Add a README'",
624                                 "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z",
625                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
626                                 "echo 'This project is wonderful' > README"
627                                 ],
628                         "teardown": [
629                                 "git log -p",
630                                 "git status"
631                                 ],
632                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-commit.html",
633                         "tags": [
634                                 "commit",
635                                 "rewrite"
636                                 ]
637                 },
638                 {
639                         "class": "ScriptQuestion",
640                         "interpreter": "sh",
641                         "id": "gitignore",
642                         "prompt": "Tell git to ignore files ending with `~`.",
643                         "answer": "echo '*~' > .gitignore",
644                         "setup": [
645                                         "git init"
646                                         ],
647                         "teardown": [
648                                 "touch some-file~",
649                                 "git status | grep some-file"
650                                 ],
651                         "help": "http://www.kernel.org/pub/software/scm/git/docs/gitignore.html",
652                         "tags": [
653                                 "config"
654                                 ]
655                 },
656                 {
657                         "class": "ScriptQuestion",
658                         "interpreter": "sh",
659                         "id": "git branch",
660                         "prompt": "List all the local branches in your repository.",
661                         "answer": "git branch",
662                         "setup": [
663                                 "export GIT_AUTHOR_NAME='A U Thor'",
664                                 "export GIT_AUTHOR_EMAIL=author@example.com",
665                                 "export GIT_COMMITTER_NAME='C O Mitter'",
666                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
667                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
668                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
669                                 "(mkdir origin",
670                                 " cd origin",
671                                 " git init",
672                                 " git commit --allow-empty -m 'Dummy commit'",
673                                 " git branch feature-x",
674                                 " git branch feature-y",
675                                 ")",
676                                 "git clone origin test",
677                                 "cd test",
678                                 "git branch feature-z"
679                                 ],
680                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-branch.html",
681                         "tags": [
682                                 "branch"
683                                 ]
684                 },
685                 {
686                         "class": "ScriptQuestion",
687                         "interpreter": "sh",
688                         "id": "git branch -a",
689                         "prompt": "List all the branches (local and remote-tracking) in your repository.",
690                         "answer": "git branch -a",
691                         "setup": [
692                                 "export GIT_AUTHOR_NAME='A U Thor'",
693                                 "export GIT_AUTHOR_EMAIL=author@example.com",
694                                 "export GIT_COMMITTER_NAME='C O Mitter'",
695                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
696                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
697                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
698                                 "(mkdir origin",
699                                 " cd origin",
700                                 " git init",
701                                 " git commit --allow-empty -m 'Dummy commit'",
702                                 " git branch feature-x",
703                                 " git branch feature-y",
704                                 ")",
705                                 "git clone origin test",
706                                 "cd test",
707                                 "git branch feature-z"
708                                 ],
709                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-branch.html",
710                         "tags": [
711                                 "branch"
712                                 ]
713                 },
714                 {
715                         "class": "ScriptQuestion",
716                         "interpreter": "sh",
717                         "id": "git branch -r",
718                         "prompt": "List the remote-tracking branches in your repository.",
719                         "answer": "git branch -r",
720                         "setup": [
721                                 "export GIT_AUTHOR_NAME='A U Thor'",
722                                 "export GIT_AUTHOR_EMAIL=author@example.com",
723                                 "export GIT_COMMITTER_NAME='C O Mitter'",
724                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
725                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
726                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
727                                 "(mkdir origin",
728                                 " cd origin",
729                                 " git init",
730                                 " git commit --allow-empty -m 'Dummy commit'",
731                                 " git branch feature-x",
732                                 " git branch feature-y",
733                                 ")",
734                                 "git clone origin test",
735                                 "cd test",
736                                 "git branch feature-z"
737                                 ],
738                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-branch.html",
739                         "tags": [
740                                 "branch"
741                                 ]
742                 },
743                 {
744                         "class": "ScriptQuestion",
745                         "interpreter": "sh",
746                         "id": "git branch -d",
747                         "prompt": "Delete the local `widget-x` branch",
748                         "answer": "git branch -d widget-x",
749                         "setup": [
750                                 "export GIT_AUTHOR_NAME='A U Thor'",
751                                 "export GIT_AUTHOR_EMAIL=author@example.com",
752                                 "export GIT_COMMITTER_NAME='C O Mitter'",
753                                 "export GIT_COMMITTER_EMAIL=committer@example.com",
754                                 "export GIT_AUTHOR_DATE=1970-01-01T00:00:00Z",
755                                 "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"",
756                                 "git init",
757                                 "git commit --allow-empty -m 'Dummy commit'",
758                                 "git branch widget-x"
759                                 ],
760                         "help": "http://www.kernel.org/pub/software/scm/git/docs/git-branch.html",
761                         "tags": [
762                                 "branch"
763                                 ]
764                 }
765         ]
766 }