計算機科学のブログ

ほしい物リスト

Git - GitHub - Collaborating with Git - Ⅱ: Go, Team, Go! - branch, switch, very verbose flag, add, commit, log

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

入出力結果(Terminal, Zsh)

% cd sangitas-clone 
sangitas-clone % git status    
On branch sangita-add-profile
Your branch is up to date with 'origin/sangita-add-profile'.

nothing to commit, working tree clean
sangitas-clone % git branch
  master
* sangita-add-profile
sangitas-clone % git branch -a
  master
* sangita-add-profile
  remotes/origin/HEAD -> origin/master
  remotes/origin/addison-add-faqs
  remotes/origin/master
  remotes/origin/sangita-add-profile
sangitas-clone % git switch addison-add-faqs 
branch 'addison-add-faqs' set up to track 'origin/addison-add-faqs'.
Switched to a new branch 'addison-add-faqs'
sangitas-clone % git branch -vv
* addison-add-faqs    c3542a0 [origin/addison-add-faqs] add second FAQ
  master              b278f04 [origin/master] addison's first commit
  sangita-add-profile 2350fc1 [origin/sangita-add-profile] add sample profile
sangitas-clone % git ls                             
git: 'ls' is not a git command. See 'git --help'.

The most similar command is
	log
sangitas-clone % ls
FAQ.md		README.md
sangitas-clone % cp ../../headfirst-git-samples/chapter06/FAQ-3.md FAQ.md 
sangitas-clone % git add FAQ.md 
sangitas-clone % git status
On branch addison-add-faqs
Your branch is up to date with 'origin/addison-add-faqs'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   FAQ.md

sangitas-clone % git commit -m 'add third FAQ'
[addison-add-faqs 361d4bb] add third FAQ
 1 file changed, 6 insertions(+)
sangitas-clone % git log --oneline --all --graph 
* 361d4bb (HEAD -> addison-add-faqs) add third FAQ
* c3542a0 (origin/addison-add-faqs) add second FAQ
| * 2350fc1 (origin/sangita-add-profile, sangita-add-profile) add sample profile
|/  
* b278f04 (origin/master, origin/HEAD, master) addison's first commit
* 32b1d92 add README
sangitas-clone %