Git - Beginning Git: Get Going with Git - index, add command
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter1.(Beginning Git: Get Going with Git)、SHARPEN YOUR PENCIL(83/120)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
Initialized empty Git repository in /Users/.../play-with-index/.git/
% touch multiple-add.txt
% status
zsh: command not found: status
% git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
multiple-add.txt
nothing added to commit but untracked files present (use "git add" to track)
% git add multiple-add.txt
% git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: multiple-add.txt
% echo 'this is my second edit' > multiple-add.txt
% git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: multiple-add.txt
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: multiple-add.txt
% git add multiple-add.txt
% git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: multiple-add.txt
%