Open drop-stones opened 3 years ago
$ echo new-feature3 >> feature
$ git add .
$ git commit -m "Add feature3"
[br-dev 3ab5340] Add feature3
1 file changed, 1 insertion(+)
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 2 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 335 bytes | 335.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/drop-stones/myproj.git
999aa0e..3ab5340 br-dev -> br-dev
$ git clone https://github.com/drop-stones/Tank-in-Desert.git
Cloning into 'Tank-in-Desert'...
remote: Enumerating objects: 75, done.
remote: Counting objects: 100% (75/75), done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 75 (delta 5), reused 67 (delta 1), pack-reused 0
Unpacking objects: 100% (75/75), 1006.52 KiB | 1.13 MiB/s, done.
$ cd Tank-in-Desert/
$ git remote -v
origin https://github.com/drop-stones/Tank-in-Desert.git (fetch)
origin https://github.com/drop-stones/Tank-in-Desert.git (push)
git cherry-pick C1 C2 ...
: pick commits (C1 C2 ...) and do commits them to the current branchgit rebase -i commit-id
pick
to other keywords$ git checkout master
$ git cherry-pick bugFix
$ git rebase -i master
$ git commit --amend
$ git rebase -i master
$ git checkout master
$ git merge caption
$ git checkout master
$ git cherry-pick newImage
$ git commit --amend
$ git cherry-pick caption
$ git tag <tag name> <commit id>
git describe <ref>
outputs the latest tag form of <tag>_<numCommits>_g<hash>
Rebasing over 9000 times
git rebase <upstream> <branch>
: do commits of upstream, and do commits of branch
$ git rebase master bugFix // master -> bugFix
$ git rebase bugFix side // master -> bugFix -> side
$ git rebase side another // master -> bugFix -> side -> another
$ git rebase another master // fast-forward: move master to another
Specifying parents
HEAD~
: 一つ前に戻るHEAD~n
: n個前に戻るHEAD^
: 一つ前の親の中の先頭要素に戻るHEAD^n
: 一つ前の親の中のn番目の要素に戻る
$ git branch bugWork HEAD~^2~
Branch spaghetti
$ git rebase master one // fast-forward: one move to master
$ git rebase -i C1 // change commits of one
$ git rebase master two // fast-forward: two move to master
$ git rebase -i C1 // change commits of two
$ git rebase C2 three // fast-forward: three move to C2
All Clear!!
演習5: ブランチbr-devを切り、いくつかコミットしPull Requestを出せ
ブランチbr-devを切る
いくつかコミット
Pull Requestを出す