From 7b3249956d9950841414bf95cbbbfde4850bdd71 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 6 Feb 2013 17:39:26 -0500 Subject: [PATCH] quizzes/git: Add 'git log *' questions New questions: * git log * git log -p * git log --stat * git log --all * git log --oneline * git log --oneline --graph * git log --oneline --decorate --- quizzes/git.json | 227 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) diff --git a/quizzes/git.json b/quizzes/git.json index ed48769..2acff0c 100644 --- a/quizzes/git.json +++ b/quizzes/git.json @@ -295,6 +295,233 @@ "query" ] }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log", + "prompt": "Print the commits leading up to your current state.", + "answer": "git log", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log -p", + "prompt": [ + "Print the commits leading up to your current state,", + "showing a patch for each commit." + ], + "answer": "git log -p", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log --stat", + "prompt": [ + "Print the commits leading up to your current state,", + "showing the files changed by each commit." + ], + "answer": "git log --stat", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log --all", + "prompt": [ + "Print every commit in your repository reachable from a reference", + "(e.g from any tag or branch)" + ], + "answer": "git log --all", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "git checkout -b more-widgets", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'", + "git checkout master" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query", + "branch" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log --oneline", + "prompt": [ + "Print the commits leading up to your current state,", + "with each commit only using a single line." + ], + "answer": "git log --oneline", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log --oneline --graph", + "prompt": [ + "Print the commits leading up to your current state,", + "with each commit only using a single line", + "and an ASCII-art inheritence graph." + ], + "answer": "git log --oneline --graph", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query" + ] + }, + { + "class": "ScriptQuestion", + "interpreter": "sh", + "id": "git log --oneline --decorate", + "prompt": [ + "Print the commits leading up to your current state,", + "with each commit only using a single line", + "and reference (e.g. tag and branch) names before the summary" + ], + "answer": "git log --oneline --decorate", + "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'", + "export GIT_AUTHOR_DATE=1970-01-01T00:01:00Z", + "export GIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"", + "echo 'Take a look in the widgets file.' >> README", + "echo 'Widget-1 should be blue' >> widgets", + "git commit -am 'More widgets'" + ], + "help": "http://www.kernel.org/pub/software/scm/git/docs/git-log.html", + "tags": [ + "query", + "branch" + ] + }, { "class": "ScriptQuestion", "interpreter": "sh", -- 2.26.2