Git - GitHub - Collaborating with Git - Part Ⅰ: Remote Work - subcommands, branch, switch
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(404/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 feat-a
% git switch feat-a
Switched to branch 'feat-a'
% git status
On branch feat-a
nothing to commit, working tree clean
% code -n feat-a-01.md
% git add feat-a-01.md
% git commit -m 'my first commit on feat-a'
[feat-a 76d6cd5] my first commit on feat-a
1 file changed, 1 insertion(+)
create mode 100644 feat-a-01.md
% git switch master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
% code -n master-03.md
% git add master-03.md
% git commit -m 'my second commit on master'
[master c0e9aa0] my second commit on master
1 file changed, 1 insertion(+)
create mode 100644 master-03.md
% git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
% git log --oneline --all --graph
* c0e9aa0 (HEAD -> master) my second commit on master
| * 76d6cd5 (feat-a) my first commit on feat-a
|/
* 177e981 (origin/master, origin/HEAD) my first commit on master
* 5aefc0d add master-01 file
* f9fd4aa add README
%