コミュ障のためのpull request 〜そしてプルリク充へ〜
DESCRIPTION
Pull Requestするときにもうつらい思いをしないためのことをまとめたスライド 某勉強会資料TRANSCRIPT
![Page 1: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/1.jpg)
コミュ障のための Pull Request
![Page 2: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/2.jpg)
–僕
“アッ…良いPull Requestに言葉はイ、要らぬ”
![Page 3: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/3.jpg)
なるべくいいかんじに Pull Requestをして
コミュニケーションでつらい思いをしないために
![Page 4: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/4.jpg)
あなたのコードはどこから?
Master Branch にPushできる
複数人で開発している
リポジトリ共有式 Pull Request
fork式 Pull Request
yes
no
yes
普通に Commit
no
![Page 5: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/5.jpg)
あなたのコードはどこから?
Master Branch にPushできる
複数人で開発している
リポジトリ共有式 Pull Request
fork式 Pull Request
yes
no
yes
普通に Commit
no
今回のトピックはこちら
![Page 6: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/6.jpg)
Pull Requestの流れ fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
![Page 7: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/7.jpg)
誰かのリポジトリをforkする fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
![Page 8: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/8.jpg)
–僕
“誰かがいたら、困ってねぇし練習してるよ”
![Page 9: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/9.jpg)
練習に便利な 「誰かのリポジトリ」
• GithubのOctcatさんの
• Spoon-Knife
• 英語だけど怯まない
https://github.com/octocat/Spoon-Knife
![Page 10: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/10.jpg)
forkしたリポジトリをclone fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
![Page 11: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/11.jpg)
forkしたリポジトリをclone fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git clone [email protected]:hoge/Spoon-Knife.git $ cd Spoon-Knife
![Page 12: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/12.jpg)
Prototype branch で試行錯誤
fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git checkout -b Spoon-Knife_prototype Switched to a new branch ‘Spoon-Knife_prototype’ $ vim README.md #試行錯誤その1 $ git commit -am ‘試行錯誤1’ $ vim README.md #試行錯誤その2 $ git commit -am ‘試行錯誤2’
![Page 13: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/13.jpg)
こんなログがでましたね?$ git log [~/Development/Spoon-Knife] commit 550f2579700000000000000000000000000000 Author: hogehoge Date: Thu May 1 20:45:09 2112 +0900 ! 試行錯誤2 !commit 17e3ef37700000000000000000000000000000 Author: hogehoge Date: Thu May 8 20:44:13 2112 +0900 ! 試行錯誤1
![Page 14: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/14.jpg)
Prototype branch をpush
fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git push origin Spoon-Knife_prototype
![Page 15: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/15.jpg)
Githubに行くと
![Page 16: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/16.jpg)
さあPull Requestだ
![Page 17: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/17.jpg)
My Pull Request
• Pull Request: ここ、なおしたったで
• fork元の変更?コンフリクト?しらんがな
• そっちでなんとかしてや^ー^v
![Page 18: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/18.jpg)
(#^ω^)ビキビキ
![Page 19: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/19.jpg)
fork元の更新を適用 fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git remote add upstream https://github.com/octocat/Spoon-Knife.git #初回のみ $ git stash $ git checkout master $ git pull upstream master $ git checkout Spoon-Knife_prototype $ git rebase master Spoon-Knife_prototype # ここでコンフリクトしたら適宜直す $ git push origin master $ git push -f origin Spoon-Knife_prototype !$ git checkout Spoon-Knifea_prototype $ git stash pop # ここでもコンフリクトしたら適宜直す
![Page 20: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/20.jpg)
Pull Requestが来ると やっぱちょっとうれしい。
どんなのかな?
![Page 21: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/21.jpg)
Pull Request List• List1 “変えたよ” author: Hoge
• List2 “変えたった” author: Hoge
• List3 “変えましたわ!” author: Hoge
• List4 “か、変えてやったわ…///” author: Hoge
• List5 “変えたお” author: Hoge
![Page 22: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/22.jpg)
(#^ω^)ビキビキ
![Page 23: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/23.jpg)
Pull Request用に commitをまとめる
fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git checkout Spoon-Knife_prototype $ git checkout -b Spoon-Knife_PR $ git rebase -i master !##【編集前】エディタ上 pick e310d46 試行錯誤1 pick 1452498 試行錯誤2 ##【編集後】エディタ上 pick e310d46 試行錯誤 squash 1452498 2つ目以降のcommit !ログはこれまでの変更をまとめたものを書く。 「なにを、どうして、どうやって変えたか」 !これでSpoon-Knife_PRに1つのcommitとしてまとまる。
![Page 24: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/24.jpg)
Pull Requestを送る fork式 Pull Request forkする
cloneする
Prototype branch作成
更新に対応したbranch作成
Pull Request
$ git push origin Spoon-Knife_PR
GithubからPull Requestを送る メッセージ欄で色々やりとりして 認められたらたぶんマージされる.
!これまでの流れを実践し、 良いコードを書くと ここが減らせるかも
![Page 25: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/25.jpg)
こんなかんじ
![Page 26: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/26.jpg)
・平易な表現 ・issue番号やコードを明確に示す ・何をした(Fix, Add, Support)か示す
![Page 27: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/27.jpg)
と受け取った時 わかりやすいかも。
例: Title: Fix FUGAFUGA(#23). Change HOGEHOGE for FUGAFUGA(#23).
![Page 28: コミュ障のためのPull Request 〜そしてプルリク充へ〜](https://reader034.vdocuments.site/reader034/viewer/2022042518/54925b71ac795959288b4775/html5/thumbnails/28.jpg)
これであなたも 立派なプルリク充