計算機科学のブログ

ほしい物リスト

Git - Searching Git Repositories: Git a Grep - checking out a commit

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(594/715)の解答を求めてみる。

入出力結果(Terminal, Zsh)

% ls
README.md	appetizers.md	dinner.md	drinks.md
% git checkout 99fd56e6628bb154a64b8171f8f3af2be2f96c6e
Note: switching to '99fd56e6628bb154a64b8171f8f3af2be2f96c6e'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 99fd56e add first draft of appetizer and drink menus
% ls
README.md	appetizers.md	drinks.md
%