Git - GitHub - Collaborating with Git - Part Ⅱ: Go, Team Go! - push, set-upsream flag
Head First Git: A Learner’s Guide to Understanding Git from the Inside Out、 Raju Gandhi(著)、 O’Reilly Mediaの Chapter 6.(Collaborating with Git - Part Ⅱ: Go, Team Go!)、EXERCISE(481/715)の解答を求めてみる。
入出力結果(Terminal, Zsh)
% git branch -vv
* master 275d4d6 [origin/master] addison's first commit
% git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
% git branch sangita-add-profile
% git switch sangita-add-profile
Switched to branch 'sangita-add-profile'
% cp ../../headfirst-git-samples/chapter06/Profile-1.md Profile.md
% git status
On branch sangita-add-profile
Untracked files:
(use "git add <file>..." to include in what will be committed)
Profile.md
nothing added to commit but untracked files present (use "git add" to track)
% git add Profile.md
% git status
On branch sangita-add-profile
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: Profile.md
% git commit -m 'add sample profile'
[sangita-add-profile 551184c] add sample profile
1 file changed, 9 insertions(+)
create mode 100644 Profile.md
% git branch -vv
master 275d4d6 [origin/master] addison's first commit
* sangita-add-profile 551184c add sample profile
% 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'.
% git push -u 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), 384 bytes | 384.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'.
% git branch -vv
master 275d4d6 [origin/master] addison's first commit
* sangita-add-profile 551184c [origin/sangita-add-profile] add sample profile
%