Git - Making your life Easier with Git: Pro Tips - subcommand, config, list, global, local
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter 8.(Making your life Easier with Git: #Pro Tips)、SHARPEN YOUR PENCIL(604/680)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% mkdir a-head-above
% cd a-head-above
% mkdir chapter-08
% 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/.../a-head-above/.git/
% git config --local user.name k
% git config
error: no action specified
% git config --list
credential.helper=osxkeychain
user.name=kamimura
user.email=kamimura@live.jp
core.editor=code -w
push.default=simple
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
user.name=k
% cp ../../headfirst-git-samples/chapter08/README.md .
% git add README.md
% git commit -m 'docs: add a README file'
[master (root-commit) 6164359] docs: add a README file
1 file changed, 3 insertions(+)
create mode 100644 README.md
% git log
commit 6164359355685f5c3a90ac516cbcf1301e4b2c33 (HEAD -> master)
Author: k <kamimura@live.jp>
Date: Fri Jun 13 18:18:34 2025 +0900
docs: add a README file
%