Git - Looking Around: Investigating Your Git Repository - log, commits, branch
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter 5.(Looking Around: Investigating Your Git Repository)、EXERCISE(221/680)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% git status
On branch spicy-version
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: saucy.md
% git log --oneline
8d670e9 (HEAD -> spicy-version) update recipe name
4cca5a7 make it spicy
5db2b68 (master) first attempt
% git log --oneline --all
8d670e9 (HEAD -> spicy-version) update recipe name
4cca5a7 make it spicy
0065b8a (different-base) cut down salt
549e0da use sour cream
5db2b68 (master) first attempt
% git log --oneline --all --graph
* 8d670e9 (HEAD -> spicy-version) update recipe name
* 4cca5a7 make it spicy
| * 0065b8a (different-base) cut down salt
| * 549e0da use sour cream
|/
* 5db2b68 (master) first attempt
% git switch different-base
error: Your local changes to the following files would be overwritten by checkout:
saucy.md
Please commit your changes or stash them before you switch branches.
Aborting
% git switch main
fatal: invalid reference: main
% git switch master
error: Your local changes to the following files would be overwritten by checkout:
saucy.md
Please commit your changes or stash them before you switch branches.
Aborting
%