Git - GitHub - Collaborating with Git - Ⅱ: Go, Team, Go! - fetch, prune, remote branch, delete, merge
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(50’/680)の解答を求めてみる。
入出力結果(Terminal, Zsh)
ch6 % cd sangitas-clone
sangitas-clone % git status
On branch addison-add-faqs
Your branch is up to date with 'origin/addison-add-faqs'.
nothing to commit, working tree clean
sangitas-clone % git branch
* addison-add-faqs
master
sangita-add-profile
sangitas-clone % git branch -a
* addison-add-faqs
master
sangita-add-profile
remotes/origin/HEAD -> origin/master
remotes/origin/addison-add-faqs
remotes/origin/master
remotes/origin/sangita-add-profile
sangitas-clone % git fetch
remote: Enumerating objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3 (from 2)
Unpacking objects: 100% (3/3), 465 bytes | 232.00 KiB/s, done.
From https://github.com/kamimura/hawtdawg-all-ears
2350fc1..a055631 sangita-add-profile -> origin/sangita-add-profile
sangitas-clone % git branch -a
* addison-add-faqs
master
sangita-add-profile
remotes/origin/HEAD -> origin/master
remotes/origin/addison-add-faqs
remotes/origin/master
remotes/origin/sangita-add-profile
sangitas-clone % git switch sangita-add-profile
Switched to branch 'sangita-add-profile'
Your branch is behind 'origin/sangita-add-profile' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
sangitas-clone % git branch -a
addison-add-faqs
master
* sangita-add-profile
remotes/origin/HEAD -> origin/master
remotes/origin/addison-add-faqs
remotes/origin/master
remotes/origin/sangita-add-profile
sangitas-clone % git status
On branch sangita-add-profile
Your branch is behind 'origin/sangita-add-profile' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working tree clean
sangitas-clone % git merge origin/sangita-add-profile
Updating 2350fc1..a055631
Fast-forward
Profile.md | 2 ++
1 file changed, 2 insertions(+)
sangitas-clone % git status
On branch sangita-add-profile
Your branch is up to date with 'origin/sangita-add-profile'.
nothing to commit, working tree clean
sangitas-clone % git log --oneline
a055631 (HEAD -> sangita-add-profile, origin/sangita-add-profile) update profile
2350fc1 add sample profile
b278f04 (origin/master, origin/HEAD, master) addison's first commit
32b1d92 add README
% git status
On branch sangita-add-profile
Your branch is up to date with 'origin/sangita-add-profile'.
nothing to commit, working tree clean
sangitas-clone %
入出力結果(Terminal, Zsh)
addisons
% cd addisons-clone
addisons-clone % git branch
* addison-add-faqs
master
sangita-add-profile
addisons-clone % git branch -v
* addison-add-faqs 361d4bb add third FAQ
master b278f04 addison's first commit
sangita-add-profile a055631 update profile
addisons-clone % git branch -vv
* addison-add-faqs 361d4bb [origin/addison-add-faqs] add third FAQ
master b278f04 [origin/master] addison's first commit
sangita-add-profile a055631 [origin/sangita-add-profile] update profile
addisons-clone % git fetch -p
From https://github.com/kamimura/hawtdawg-all-ears
- [deleted] (none) -> origin/addison-add-faqs
- [deleted] (none) -> origin/sangita-add-profile
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 1 (from 1)
Unpacking objects: 100% (3/3), 1.83 KiB | 1.83 MiB/s, done.
b278f04..25287c5 master -> origin/master
addisons-clone % git branch -vv
* addison-add-faqs 361d4bb [origin/addison-add-faqs: gone] add third FAQ
master b278f04 [origin/master: behind 6] addison's first commit
sangita-add-profile a055631 [origin/sangita-add-profile: gone] update profile
addisons-clone % git switch master
Switched to branch 'master'
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
addisons-clone % git branch -d addison-add-faqs
error: the branch 'addison-add-faqs' is not fully merged
hint: If you are sure you want to delete it, run 'git branch -D addison-add-faqs'
hint: Disable this message with "git config set advice.forceDeleteBranch false"
addisons-clone % git branch -d sangita-add-profile
error: the branch 'sangita-add-profile' is not fully merged
hint: If you are sure you want to delete it, run 'git branch -D sangita-add-profile'
hint: Disable this message with "git config set advice.forceDeleteBranch false"
addisons-clone % git branch -D addison-add-faqs
Deleted branch addison-add-faqs (was 361d4bb).
addisons-clone % git branch -vv
* master b278f04 [origin/master: behind 6] addison's first commit
sangita-add-profile a055631 [origin/sangita-add-profile: gone] update profile
addisons-clone % git branch -d sangita-add-profile
error: the branch 'sangita-add-profile' is not fully merged
hint: If you are sure you want to delete it, run 'git branch -D sangita-add-profile'
hint: Disable this message with "git config set advice.forceDeleteBranch false"
addisons-clone % git merge origin/master
Updating b278f04..25287c5
Fast-forward
FAQ.md | 12 ++++++++++++
Profile.md | 11 +++++++++++
2 files changed, 23 insertions(+)
create mode 100644 Profile.md
addisons-clone % git branch -d sangita-add-profile
Deleted branch sangita-add-profile (was a055631).
addisons-clone % git log --oneline --all --graph
* 25287c5 (HEAD -> master, origin/master, origin/HEAD) Merge pull request #2 from kamimura/sangita-add-profile
|\
| * a055631 update profile
| * 2350fc1 add sample profile
* | c1677e6 Merge pull request #1 from kamimura/addison-add-faqs
|\ \
| |/
|/|
| * 361d4bb add third FAQ
| * c3542a0 add second FAQ
|/
* b278f04 addison's first commit
* 32b1d92 add README
addisons-clone %
sangitas
% cd sangitas-clone
sangitas-clone % git branch -v
addison-add-faqs 361d4bb add third FAQ
master b278f04 addison's first commit
* sangita-add-profile a055631 update profile
sangitas-clone % git branch -vv
addison-add-faqs 361d4bb [origin/addison-add-faqs] add third FAQ
master b278f04 [origin/master] addison's first commit
* sangita-add-profile a055631 [origin/sangita-add-profile] update profile
sangitas-clone % git branch -a
addison-add-faqs
master
* sangita-add-profile
remotes/origin/HEAD -> origin/master
remotes/origin/addison-add-faqs
remotes/origin/master
remotes/origin/sangita-add-profile
sangitas-clone % git fetch
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 1 (from 1)
Unpacking objects: 100% (3/3), 1.83 KiB | 938.00 KiB/s, done.
From https://github.com/kamimura/hawtdawg-all-ears
b278f04..25287c5 master -> origin/master
sangitas-clone % git branch -vv
addison-add-faqs 361d4bb [origin/addison-add-faqs] add third FAQ
master b278f04 [origin/master: behind 6] addison's first commit
* sangita-add-profile a055631 [origin/sangita-add-profile] update profile
sangitas-clone % git fetch -p
From https://github.com/kamimura/hawtdawg-all-ears
- [deleted] (none) -> origin/addison-add-faqs
- [deleted] (none) -> origin/sangita-add-profile
sangitas-clone % git branch -vv
addison-add-faqs 361d4bb [origin/addison-add-faqs: gone] add third FAQ
master b278f04 [origin/master: behind 6] addison's first commit
* sangita-add-profile a055631 [origin/sangita-add-profile: gone] update profile
sangitas-clone % git switch master
Switched to branch 'master'
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
sangitas-clone % git branch -d addison-add-faqs
error: the branch 'addison-add-faqs' is not fully merged
hint: If you are sure you want to delete it, run 'git branch -D addison-add-faqs'
hint: Disable this message with "git config set advice.forceDeleteBranch false"
sangitas-clone % git branch -a
addison-add-faqs
* master
sangita-add-profile
remotes/origin/HEAD -> origin/master
remotes/origin/master
sangitas-clone % git merge origin/master
Updating b278f04..25287c5
Fast-forward
FAQ.md | 12 ++++++++++++
Profile.md | 11 +++++++++++
2 files changed, 23 insertions(+)
create mode 100644 Profile.md
sangitas-clone % git branch -d addison-add-faqs
Deleted branch addison-add-faqs (was 361d4bb).
sangitas-clone % git branch -d sangita-add-profile
Deleted branch sangita-add-profile (was a055631).
sangitas-clone % git branch -vv
* master 25287c5 [origin/master] Merge pull request #2 from kamimura/sangita-add-profile
sangitas-clone % git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
sangitas-clone %