計算機科学のブログ

ほしい物リスト

Git - Looking Around: Investigating Your Git Repository - add, commit, message

Head First Git: A Learner’s Guide to Understanding Git from the Inside OutRaju Gandhi(著)、 O’Reilly Mediaの Chapter 5.(Looking Around: Investigating Your Git Repository)、EXERCISE(243/680)の解答を求めてみる。

入出力結果(Terminal, Zsh)

% git branch
  different-base
  master
* spicy-version
% git status
On branch spicy-version
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   saucy.md

no changes added to commit (use "git add" and/or "git commit -a")
% git add saucy.md 
% git commit -m 'add punch.'
[spicy-version 023d4b3] add punch.
 1 file changed, 3 insertions(+), 3 deletions(-)
% git status
On branch spicy-version
nothing to commit, working tree clean
% git log --oneline
023d4b3 (HEAD -> spicy-version) add punch.
8d670e9 update recipe name
4cca5a7 make it spicy
5db2b68 (master) first attempt
% git log --oneline --all --graph 
* 023d4b3 (HEAD -> spicy-version) add punch.
* 8d670e9 update recipe name
* 4cca5a7 make it spicy
| * 0065b8a (different-base) cut down salt
| * 549e0da use sour cream
|/  
* 5db2b68 (master) first attempt
%