計算機科学のブログ

ほしい物リスト

Git - GitHub - Searching Git Repositories - Git a Grep - subcommond, bisect, good, bad

Head First Git: A Learner’s Guide to Understanding Git from the Inside OutRaju Gandhi(著)、 O’Reilly Mediaの Chapter 7.(Searching Git Repositories: Git a Grep)、EXERCISE(575/cod680)の解答を求めてみる。

入出力結果(Terminal, Zsh)

% git status 
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
% git bisect start 
status: waiting for both good and bad commits
% git status
On branch master
Your branch is up to date with 'origin/master'.

You are currently bisecting, started from branch 'master'.
  (use "git bisect reset" to get back to the original branch)

nothing to commit, working tree clean
% git bisect bad 
status: waiting for good commit(s), bad commit known
% git bisect good 6b11ec8
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[b6c8c826ed98583a175ea4616ba9aad48ec0b1ad] replace meat dishes with vegetarian items
% cat appetizers.md 
# Gitanjali and Aref Reception: Appetizers

* Herb-sprinkled stuffed mushrooms
* Blinnis with spiced fruit and nut chutney
* Mini grilled cheese sandwiches
% git bisect bad
Bisecting: 0 revisions left to test after this (roughly 1 step)
[d36c9830823a17c42025713dcbc3bc29bbb4ce36] add first draft of dinner menu
% cat appetizers.md
# Gitanjali and Aref Reception: Appetizers

* Herb-sprinkled stuffed mushrooms
* Blinis with salmon, caviar, and crème fraiche
* Mini roast-beef sandwiches
% git bisect good
b6c8c826ed98583a175ea4616ba9aad48ec0b1ad is the first bad commit
commit b6c8c826ed98583a175ea4616ba9aad48ec0b1ad
Author: Armstrong <armstrong@eventplannerz.com>
Date:   Tue Jul 13 04:25:01 2021 -0400

    replace meat dishes with vegetarian items

 appetizers.md | 4 ++--
 dinner.md     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
% cat appetizers.md
# Gitanjali and Aref Reception: Appetizers

* Herb-sprinkled stuffed mushrooms
* Blinis with salmon, caviar, and crème fraiche
* Mini roast-beef sandwiches
% git bisect reset
% git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
%