Git - GitHub - Collaborating with Git - Part Ⅰ: Remote Work - new branch, switch, add, commit, message
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter 5.(Collaborating with Git - Part Ⅰ: Remote Work)、EXERCISE(385/680)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% cd working-with-remotes
working-with-remotes % git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
working-with-remotes % git branch
* master
working-with-remotes % git branch feat-a
working-with-remotes % git branch
feat-a
* master
working-with-remotes % git switch feat-a
Switched to branch 'feat-a'
working-with-remotes % code .
working-with-remotes % git add feat-a-01.md
working-with-remotes % git status
On branch feat-a
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: feat-a-01.md
working-with-remotes % git commit -m 'my first commit on feat-a'
[feat-a 8ccb875] my first commit on feat-a
1 file changed, 1 insertion(+)
create mode 100644 feat-a-01.md
working-with-remotes % git switch master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
working-with-remotes % git add master-03.md
working-with-remotes % git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: master-03.md
working-with-remotes % git commit -m 'my second commit on master'
[master 6780b56] my second commit on master
1 file changed, 1 insertion(+)
create mode 100644 master-03.md
working-with-remotes % git log --oneline --all --graph
* 6780b56 (HEAD -> master) my second commit on master
| * 8ccb875 (feat-a) my first commit on feat-a
|/
* 873304c (origin/master, origin/HEAD) my first commit on master
* 5aefc0d add master-01 file
* f9fd4aa add README
working-with-remotes %