コミュ障のためのpull request 〜そしてプルリク充へ〜

28
コミュ障のための Pull Request

Upload: ensekitt

Post on 17-Dec-2014

986 views

Category:

Engineering


3 download

DESCRIPTION

Pull Requestするときにもうつらい思いをしないためのことをまとめたスライド 某勉強会資料

TRANSCRIPT

Page 1: コミュ障のためのPull Request 〜そしてプルリク充へ〜

コミュ障のための Pull Request

Page 2: コミュ障のためのPull Request 〜そしてプルリク充へ〜

–僕

“アッ…良いPull Requestに言葉はイ、要らぬ”

Page 3: コミュ障のためのPull Request 〜そしてプルリク充へ〜

なるべくいいかんじに Pull Requestをして

コミュニケーションでつらい思いをしないために

Page 4: コミュ障のためのPull Request 〜そしてプルリク充へ〜

あなたのコードはどこから?

Master Branch にPushできる

複数人で開発している

リポジトリ共有式 Pull Request

fork式 Pull Request

yes

no

yes

普通に Commit

no

Page 5: コミュ障のためのPull Request 〜そしてプルリク充へ〜

あなたのコードはどこから?

Master Branch にPushできる

複数人で開発している

リポジトリ共有式 Pull Request

fork式 Pull Request

yes

no

yes

普通に Commit

no

今回のトピックはこちら

Page 6: コミュ障のためのPull Request 〜そしてプルリク充へ〜

Pull Requestの流れ fork式 Pull Request forkする

cloneする

Prototype branch作成

更新に対応したbranch作成

Pull Request

Page 7: コミュ障のためのPull Request 〜そしてプルリク充へ〜

誰かのリポジトリをforkする fork式 Pull Request forkする

cloneする

Prototype branch作成

更新に対応したbranch作成

Pull Request

Page 8: コミュ障のためのPull Request 〜そしてプルリク充へ〜

–僕

“誰かがいたら、困ってねぇし練習してるよ”

Page 9: コミュ障のためのPull Request 〜そしてプルリク充へ〜

練習に便利な 「誰かのリポジトリ」

• GithubのOctcatさんの

• Spoon-Knife

• 英語だけど怯まない

https://github.com/octocat/Spoon-Knife

Page 10: コミュ障のためのPull Request 〜そしてプルリク充へ〜

forkしたリポジトリをclone fork式 Pull Request forkする

cloneする

Prototype branch作成

更新に対応したbranch作成

Pull Request

Page 11: コミュ障のためのPull Request 〜そしてプルリク充へ〜

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 〜そしてプルリク充へ〜

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 〜そしてプルリク充へ〜

こんなログがでましたね?$ 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 〜そしてプルリク充へ〜

Prototype branch をpush

fork式 Pull Request forkする

cloneする

Prototype branch作成

更新に対応したbranch作成

Pull Request

$ git push origin Spoon-Knife_prototype

Page 15: コミュ障のためのPull Request 〜そしてプルリク充へ〜

Githubに行くと

Page 16: コミュ障のためのPull Request 〜そしてプルリク充へ〜

さあPull Requestだ

Page 17: コミュ障のためのPull Request 〜そしてプルリク充へ〜

My Pull Request

• Pull Request: ここ、なおしたったで

• fork元の変更?コンフリクト?しらんがな

• そっちでなんとかしてや^ー^v

Page 18: コミュ障のためのPull Request 〜そしてプルリク充へ〜

(#^ω^)ビキビキ

Page 19: コミュ障のためのPull Request 〜そしてプルリク充へ〜

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 〜そしてプルリク充へ〜

Pull Requestが来ると やっぱちょっとうれしい。

どんなのかな?

Page 21: コミュ障のためのPull Request 〜そしてプルリク充へ〜

Pull Request List• List1 “変えたよ” author: Hoge

• List2 “変えたった” author: Hoge

• List3 “変えましたわ!” author: Hoge

• List4 “か、変えてやったわ…///” author: Hoge

• List5 “変えたお” author: Hoge

Page 22: コミュ障のためのPull Request 〜そしてプルリク充へ〜

(#^ω^)ビキビキ

Page 23: コミュ障のためのPull Request 〜そしてプルリク充へ〜

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 〜そしてプルリク充へ〜

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 〜そしてプルリク充へ〜

こんなかんじ

Page 26: コミュ障のためのPull Request 〜そしてプルリク充へ〜

・平易な表現 ・issue番号やコードを明確に示す ・何をした(Fix, Add, Support)か示す

Page 27: コミュ障のためのPull Request 〜そしてプルリク充へ〜

と受け取った時 わかりやすいかも。

例: Title: Fix FUGAFUGA(#23). Change HOGEHOGE for FUGAFUGA(#23).

Page 28: コミュ障のためのPull Request 〜そしてプルリク充へ〜

これであなたも 立派なプルリク充