計算機科学のブログ

ほしい物リスト

Git - GitHub - Collaborating with Git - Part Ⅱ: Go, Team Go! - branch, switch, add, commit

Head First Git: A Learner’s Guide to Understanding Git from the Inside OutRaju Gandhi(著)、 O’Reilly Mediaの Chapter 6.(Collaborating with Git - Part Ⅱ: Go, Team Go!)、EXERCISE(460/715)の解答を求めてみる。

入出力結果(Terminal, Zsh)

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

nothing to commit, working tree clean
% git branch
* master
% git branch addison-first-faq
% git switch addison-first-faq 
Switched to branch 'addison-first-faq'
% cp ../../headfirst-git-samples/chapter06/FAQ-1.md FAQ.md
% git status
On branch addison-first-faq
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	FAQ.md

nothing added to commit but untracked files present (use "git add" to track)
% git add FAQ.md 
% git commit -m "addison's first commit"
[addison-first-faq 275d4d6] addison's first commit
 1 file changed, 7 insertions(+)
 create mode 100644 FAQ.md
% git log --graph --oneline --all
* 275d4d6 (HEAD -> addison-first-faq) addison's first commit
* 32b1d92 (origin/master, origin/HEAD, master) add README
% git diff
%