From: W. Trevor King Date: Wed, 6 Feb 2013 22:08:03 +0000 (-0500) Subject: quizzes/git: Add 'git diff *' questions X-Git-Tag: v0.1~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e8124f3cb6803fcdfe15d9e2065d0464c886daf5;p=quizzer.git quizzes/git: Add 'git diff *' questions New questions: * git diff * git diff HEAD -- * git diff HEAD -- README * git diff --cached --- diff --git a/quizzes/git.json b/quizzes/git.json index c10a62a..ed48769 100644 --- a/quizzes/git.json +++ b/quizzes/git.json @@ -174,6 +174,127 @@ "commit" ] }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git diff", + "prompt": [ + "You've edited a few files since the last commit.", + "Ask Git to display the changes you've make (but not staged)." + ], + "answer": "git diff", + "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", + "echo 'Lots of widgets' > widgets", + "git add README widgets", + "git commit -m 'Add some widgets'", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git diff HEAD --", + "prompt": [ + "You've edited a few files since the last commit.", + "Ask Git to display the changes you've make since the last commit,", + "including any changes that you may have already staged." + ], + "answer": "git diff HEAD --", + "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", + "echo 'Lots of widgets' > widgets", + "git add README widgets", + "git commit -m 'Add some widgets'", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git add README" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git diff HEAD -- README", + "prompt": [ + "You've edited a few files since the last commit.", + "Ask Git to display the changes you've make to README since the last commit,", + "including any changes that you may have already staged." + ], + "answer": "git diff 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", + "echo 'Lots of widgets' > widgets", + "git add README widgets", + "git commit -m 'Add some widgets'", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git add README" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git diff --cached", + "prompt": [ + "You've edited a few files since the last commit, and staged some of them.", + "Ask Git to display only the changes you've staged." + ], + "answer": "git diff --cached", + "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", + "echo 'Lots of widgets' > widgets", + "git add README widgets", + "git commit -m 'Add some widgets'", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git add README" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-diff.html", + "tags": [ + "query" + ] + }, { "class": "ScriptQuestion", "interpreter": "sh",