Git - GitHub - Collaborating with Git - Ⅱ: Go, Team, Go! - branches, local, remote
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter 6.(Collaborating with Git - Ⅱ: Go, Team, Go!)、EXERCISE(455/680)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% cd sangitas-clone
sangitas-clone % git branch
* master
sangitas-clone % git branch -v
* master b278f04 addison's first commit
sangitas-clone % git branch -vv
* master b278f04 [origin/master] addison's first commit
sangitas-clone % git branch sangita-add-profile
sangitas-clone % git switch sangita-add-profile
Switched to branch 'sangita-add-profile'
sangitas-clone % code .
sangitas-clone % cp ../../headfirst-git-samples/chapter06/Profile-1.md Profile.md
sangitas-clone % git add Profile.md
sangitas-clone % git status
On branch sangita-add-profile
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: Profile.md
sangitas-clone % git commit -m 'add sample profile'
[sangita-add-profile 2350fc1] add sample profile
1 file changed, 9 insertions(+)
create mode 100644 Profile.md
sangitas-clone % git branch -vv
master b278f04 [origin/master] addison's first commit
* sangita-add-profile 2350fc1 add sample profile
sangitas-clone % git push
fatal: The current branch sangita-add-profile has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin sangita-add-profile
To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.
sangitas-clone % git push --set-upstream origin sangita-add-profile
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 385 bytes | 385.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
remote:
remote: Create a pull request for 'sangita-add-profile' on GitHub by visiting:
remote: https://github.com/kamimura/hawtdawg-all-ears/pull/new/sangita-add-profile
remote:
To https://github.com/kamimura/hawtdawg-all-ears.git
* [new branch] sangita-add-profile -> sangita-add-profile
branch 'sangita-add-profile' set up to track 'origin/sangita-add-profile'.
sangitas-clone % git branch -vv
master b278f04 [origin/master] addison's first commit
* sangita-add-profile 2350fc1 [origin/sangita-add-profile] add sample profile
sangitas-clone %