ãPull Requestã ã¯ãªã¼ãã³ã½ã¼ã¹ã«éãã使ããåªããéçºããã¼ã
ãã¼ã éçºã«ããã¦ãããã±ãã/IssueããTDDããã³ã¼ãã¬ãã¥ã¼ããªã©ãã½ã¼ã¹ã³ã¼ãã®å¤æ´ã«å¯¾ããå¹æçãªéçºããã¼ã«ã¤ãã¦ããèããã®ã ãã©ããªãã«ãã¦ããã®ãããã¯é常ã«èª²é¡ãå¤ããå社åã³ãã¥ããã£ã§è²ã ãªããæ¹ã模索ããã¦ãããã¤ã³ãã ã¨æãã
ã§ãã¾ããå¤åã«æ¼ããåãããèããããã ãã©ãç¾ç¶ãã®éç¨ã§ Pull Request ãããé常ã«å¹æçãªã®ã§ã¯ãªãããã¨æãã®ã§ãã¡ãã£ã¨ã¾ã¨ãã¦ã¿ãããã¨æãã
ãã¡ãããè¨ãã¾ã§ããªããããªãã¨ã ããã¨ãã人ããããããããªããã©ããããã人ãããããããã¨ãé常ã«åã°ãããã¨ã ãã
Pull Request ã¨ã¯
GitHub ã§ããå¼ã°ãã¦ããã®ã§ãããå¼ã¶ãã¨ã«ããããããã§ã¯ãè¤æ°ã®ãªãã¸ããª/ãã©ã³ãéã§ã®ãªã¼ãã³ãª patch ã®ããã¨ãã®ãã¨ã ã¨èããã
ãã¨ãèªåã使ã£ã¦ããã®ã Git ãªã®ã§ãããã§ã¯ Git ã«ã¤ãã¦æ±ããã©ãGit 以å¤ã®åæ£VCSã§ãå½ã¦ã¯ã¾ãè°è«ã ã¨æãã
åææ¡ä»¶
- è¤æ°äººã§1ã¤ã®ã½ããã¦ã§ã¢ãéçºãã
- åæ£åVCS (Gitããã¡ãã Mercurial ãªã©ã§ãè¯ãã¨æã) ã§ãåèªããªãã¸ããªãä¿æãã¦ããã
- ãã¼ã éçºãªã®ã§å
¨å¡ãåããã®ãéçºãã¦ãã¦ããªãªã¼ã¹ããã¸ã¡ã³ãã®éç¨ã§ã¯ãã©ããã«ããã¹ã¿ã¼ãçãªãã®ãåå¨ãã
- ã¤ã¾ãããããããªãªã¼ã¹ãã¾ãããã¨ãã大å ã
- Linux ãªã©ã§ã¯ Linus ãæã£ã¦ãããªãã¸ããªããªã®ãããããªããã©ã大æµã®å ´åã¯Gitãµã¼ã (e.g. GitHub) ãªã©ã®ãããªãã®ãåå¨ãã¦ããããï¼
- åèªã¯èªåã®ãªãã¸ããªã§ãéçºãã©ã³ãã¾ãã¯éçºãã©ã³ãããæ´¾çãããã©ã³ãã§éçºãè¡ã
Pull Request
ããã¼ãæé åããã¨ãæ¦ããããããã¨ã«ãªã:
- ãããªãã¸ã㪠A ã® develop ãã©ã³ããã fork ãããªãã¸ã㪠A' ã® develop ãã©ã³ãããããããã«å¤æ´ãå ããã³ããããåå¨ããã
- ãªãã¸ã㪠A ã®ç®¡çè
(ãããã¯ããã®å¤æ´ç®æã«å¯¾ãã責任è
) ã«ããA' ã® develop ãã©ã³ãã«å¤æ´ããã¦ããã®ã§ pull ãã¦ãããã¨è¦æ±ãã
- ããã Issue (ãã±ãã) åããã
- A ã®è²¬ä»»è ãããã確èªããA' -> A ã« merge ãè¡ãã
ã¡ãªã¿ã«ãGitHub ã§ã¯ãfork ãã¦å¤æ´ã㦠push ããå
ã®ãªãã¸ããªã®ãã¼ã¸ãéããPull Request ã¨ãããã¿ã³ãæ¼ãã¦ãã©ã®ãã©ã³ããã©ã®ãã©ã³ãã« Pull Requset ãããããã¨ãã確èªããã確å®ããã¨å®äºãRequest ããã人ã¯ãdiff ã確èªãããããã®å¤æ´ããããã©ã³ãããã§ãã¯ã¢ã¦ããã¦ãã¹ããè¡ã£ãããã¦ãåé¡ããªããã° merge ãã¨ããããã¼ã¨ãªã(fast-forward å¯è½ã§ããã°ã¦ã§ãä¸ããããã¿ã³1ã¤ã§ merge ã§ãã)ã
ã½ã¼ã¹ã³ã¼ãã«å¯¾ãã責任ã¨ã«ãªã¹å
è¤æ°äººã§ã®éçºã§å¿ ãä¼´ãã®ã¯ã人ãæ¸ããã³ã¼ãã§ã¯è¶³ããªãæ©è½ãå®ç¾ããããã¨ã ã
ããã«ç»å ´ããã®ã¯ãããæ©è½ãæä¾ãããµã¼ãã¹ *1 ã¨ããããæ¸ãã Alice ãããããã¨ããã
ãã®ã¨ããã½ã¼ã¹ã³ã¼ãã«å¯¾ãã責任ã¯ãAlice ããã«ãã (ã¨ãã)ãããã¯ããããããã¨ã ã¨æãã*2
ããã¦ããã®ãµã¼ãã¹ãå©ç¨ããæ©è½ãå®è£
ãã¦ãã Bob ãããããã®ãµã¼ãã¹ã§æä¾ããã¦ããæ©è½ã ãã§ã¯è¶³ããªããã¨ã«æ°ã¥ããã¨ãããããããã¨ãã«ãããã¤ãã®ããæ¹ãããã¨æããã©ããããã¡ãã£ã¨æ¸ãã ãã¦ã¿ãããã¨æãã
å¤æ´ã»å¯¾å¿ãä¾é ¼ãã
ã²ã¨ã¤ã¯ãAlice ããã«ãããããæ©è½ã足ããªããã ãã©ã追å ãã¦ã»ãããã¨ä¾é ¼ãããã¨ã ãããã¯ã縦å²ãã«ãªã£ãä¼ç¤¾ããããããä¼ç¤¾ãéã£ãããã¯ãã¼ãºããªã©ã¤ãã©ãªãå©ç¨ãã¦ããå ´åã«ã¯ãããããã¨ã ã¨æãã
ãã ã ãªã¼ãã¼ãããã大ããã¨ããåé¡ããããAlice ããããã¤å¯¾å¿ãã¦ãããããã¨ããåé¡ *3ãå¤æ´ã®ä¾é ¼ã»å¯¾å¿ã¯ãã³ãã¥ãã±ã¼ã·ã§ã³ã³ã¹ãã大ãããããä»ãã欲ããã®ã«ãã«ã¯ã©ããã¦ã対å¿ã§ããªããããã«ãã³ãã¥ãã±ã¼ã·ã§ã³ãã¹ã§ãå¤æ´ãããã®ã«ä¾é ¼ãããæ©è½ãæä¾ãããªãå ´åããããããããå·®ãæ»ãã ããããã«ã³ã¹ãã¯ãããã
ããããããç¨åº¦ããã¯ãæ¥åå½¢æ
ã¨ãè²ã
ãªè¦å (å¤é¨ãµã¼ãã¹ãå©ç¨ããå ´åãªã©) ã«ãã£ã¦ããã¨ããªã¼ãã¼ãããã大ããã¦ããããããããå¾ãªãå ´åãå¤ãããã¾ãããã¯ä»æ¹ããªããã©..
å¤æ´ãã確èªãã¨ãã³ããããã
ããã³ãã¥ãã±ã¼ã·ã§ã³ã®ã¨ãããã¼ã ã§ã¯ãããåºæ¥ãã¨æãã
Bob ããããããæ©è½ã追å ãããå ´æãæ¢ãå½ã¦ãããã«å¤æ´ãå ãããdiff ãè¦ãã¦ããããããå¤æ´ãããããã ãã©ã㨠Alice ããã«ç¢ºèªãã¨ããAlice ããã¯ãã大ä¸å¤«ã åé¡ãªããã¨çããBob ããã¯ãããã³ãããããã
å¤æ´ããã«è§£æ±ºããæ¹æ³ãæ¢ã
å½è©²ç®æã«ã¯å¤æ´ããã«èªåã®å¸æããæ©è½ãæä¾ãããããã«ããã
ããã¯ãAliceããã®è²¬ä»»ç¯å²ã«ã¯å½±é¿ããªãèªåã®è²¬ä»»ã§ã³ã¼ãã追å ããã¨ããã¤ã¡ã¼ã¸ã
ãããããããããã¨ãç¹°ãè¿ãã¨ãè¬ã®ãªãã·ã§ã³ãå¢ããããä¼¼ãæ§ãªã¡ã½ãããå¢ããããã¦ãå¾è¿°ã®ã«ãªã¹åãå®æããã
åæã«å¤æ´ãã
æãæªãã®ã¯ãã®ãã¿ã¼ã³ãåæã«å¤æ´ãã¦ãã¾ãããã¨ãã Aliceããããããã¡ãã£ã¨ä½ãã®å¤æ´ãã¨ãªããã¨ã¯ç®ã«è¦ãã¦ããã
ãã¹ãã§ããã¦ãããã°ã¾ã è¯ãããæ°ã¥ããã«ãã°ãæ··å
¥ãã¦ããå ´åãããã
ã«ãªã¹å
ä¸çªãã©ã¤ã®ã¯ããå¤æ´ããã«è§£æ±ºããæ¹æ³ãæ¢ããã¨ãåæã«å¤æ´ãããã ã
Alice ãããä½ã£ããããæ©è½ã«å¤æ´ãå ããã«èªåã®æ¬²ããæ©è½ã追å ãã¦ãã£ããããããã¯Aliceããã®æå³ã¨ã¯å¥ã®æå³ãã³ã¼ãã«ã©ãã©ã追å ããããããã¨ããããã£ããã®ãç©ã¿éãªã£ã¦ãä¾ãã°ãä¼¼ãæ§ãªæ©è½ãæä¾ããã¡ã½ãããå¥åã§ãããããããããããããã¨ããã§ä¸¡æ¹ã使ããã¦ãããã©ã£ã¡ãæ¶ããªãæãåºããªããã¿ãããªãã¨ãããã£ã¦ãã¾ãã«ã¯ã¡ãã£ã¨éããã¨ãããä¼¼ãæ§ãªæ©è½ã«ã¤ãã¦æ´ã«åããããªãã¨ãç¹°ãè¿ããããã«ãªã¹ã§ããã
ãããªãã¨èª°ãæãä»ããããªãã®ã§ããã¼ããã¯æ¨¹æµ·ã ããããããªãã§ãã¿ãããªãã®ãå®æãããããã§ã¨ãã
Pull Request ããããããå°ããªããããã¨ã³ã¼ãã¬ãã¥ã¼ã¨ãªãã¡ã¯ã¿ã®æ©ä¼
ãããããGit ã®å©ç¹ã¨ãã¦ãèªåã®å ã«ãªãã¸ããªãæã¦ããæ°è»½ã«ãã©ã³ããåãæ°è»½ã«ãã¼ã¸ã§ãããã¨ããã®ããããã©ãPull Request ããããããæ大éçãããçæ³çãªéçºããã¼ãªã®ã§ã¯ãªããã
ä¸è¿°ã®ããã¨ãã Pull Request ã«ç½®ãæããã¨ã次ã®ããã«ãªãã
- Alice ããã責任ããã¤ç®æã«ã¤ãã¦ãBob ãããå¤æ´ããpatch ãã¤ãã (å°ããªããã)
- Pull Request ãéã
- Alice ãããããã確èªãã (ã¬ãã¥ã¼ã¨ãªãã¡ã¯ã¿)
- å¤æ´ãåãè¾¼ã
ä¸è¿°ã§ããã¨ããã®ãå¤æ´ãã確èªãã¨ãã³ããããããã«ããä¼¼ã¦ãããã©ã
- Git ã®åæ£æ§ããã©ã³ãæ©è½ãçãããå¹ççãªããã¼ãã·ã¹ãã ãã£ã¦æä¾ããã
- ãªã¼ãã³ã«ããã¨ããããã
ã¨ããç¹ãç°ãªãã
å°ããªããããç¹°ãè¿ããã¨
ã½ã¼ã¹ã³ã¼ãã¸ã®å¤æ´ã¯ã大ãããã°å¤§ããã»ã©å½±é¿ç¯å²ããã°ã®æ··å
¥ãã確çã大ãããªãã®ã§ããããã¯å°ãããã°å°ããæ¹ãè¯ãã
ã§ããã°åä¸æ©è½ã«ã¤ãã¦ãã®é½åº¦ããããããã®ãè¯ãã
ã ãããå°ããªå¤æ´ã§ããèªåã®è²¬ä»»ä¸ã§æ¸ã¾ãªãã½ã¼ã¹ã³ã¼ãã®å¤æ´ã¯ããã¹ã¦ Pull Request ã«ãªã£ã¦ããã¹ãã ãå°ã㪠diff ã§ããã°ããã»ã©ãå°ããªã³ã¹ãã§ç¢ºèªãã§ããããããç¹°ãè¿ããã¨ãéè¦ã ã
ã³ã¼ãã¬ãã¥ã¼ã®æ©ä¼ãè¨ãããã¨
ã³ã¼ãã¬ãã¥ã¼ä¼ã®ãããªãã®ãéããããã¼ã ãããã¨æããã©ãè²ã ãªå¤æ´ãå«ã¾ãã大ã㪠diff ããè¤æ°äººã責任ããã£ãã½ã¼ã¹ã³ã¼ãã«ã¤ãã¦ããã£ãºãã«ããããã®ã³ã¼ããã¬ãã¥ã¼ããã®ã¯é常ã«å¤§å¤ã ããã³ã¹ãã大ããããã®ç¹ãPull Request ã§ããã°ãå°ã㪠patch ãã¨ã«ã¬ãã¥ã¼ãå ¥ããããã³ã¹ããå°ãããè°è«ã1ç¹ã«éä¸ã§ãããã質ãé«ãã
ã¾ããé²ããã¹ããã¨ãé²ãããã¨ããå©ç¹ãããã
Bob ããã¯ããã®å¤æ´ã®å½±é¿ç¯å²ã¯ããã£ã¦ããã¤ããã§ãããã«å¯¾å¿ããã¤ããã ãã©ãæ³å®ã§ãã¦ããªãã£ãå½±é¿ç¯å²ã«ã¤ãã¦ãAliceããã®ãã§ãã¯ãå
¥ããããã¯é常ã«å¤§ããªãã¨ã *4ããåæã«å¤æ´ããããå ´åããã¨ãããã®å¤æ´ãç¥ããã¡ãã£ã¨ãªãã§ããããå¤æ´ã«ãªã£ã¦ãã®ï¼ãã¨ãªã£ã¦ãã¾ãããã§ããã ãããã¯é¿ãããã
ã³ã¼ãã«å¯¾ãããã§ãã¯ã®ç®ã¯å¤ããã°å¤ãã»ããè¯ãããã¨ã¯ããæ¯åå
¨å¡ã®å¤æ´ã誰ãããããã¯å
¨å¡ããã§ãã¯ãåãã®ã¯é常ã«å¤§å¤ãèªåãæ¸ãããã¨ã®ããåä¸æ©è½ã«å¯¾ãã¦ä»ã®äººãå¤æ´å ãããã¨ãã«ãã©ãå¤æ´ããããããã§ãã¯ã§ãããã¨ããä»çµã¿ã Pull Request ã«ãã£ã¦ãã³ã¹ãã®ä½ãå½¢ã§æä¾ãããã
ãªãã¡ã¯ã¿ããã
Bob ããã欲ããæ©è½ã«ã¤ãã¦ã®å¤æ´ãã¬ãã¥ã¼ãããã¨ãããã¨ã¯ãAliceããããããããã®æ©è½ãæä¾ããããã®å¤æ´ã«ã¨ã£ã¦è¯ãå¤æ´ãªã®ããããã§ãã¯ããããã¨ã«ãªãã
ãããã¯ãããã®ã¡ã½ããã¯ããããæå³ã§ä½¿ããããããã®å¤æ´ã¯ã³ã³ãããªãã»ãããããªãããã£ã¡ã®ã¡ã½ããã«ãªãã·ã§ã³ãä½ãããã®ãããªææ¡ãã§ãããããããªãã
å°ããªdiffã§ãªãã¡ã¯ã¿ããããã¨ã¯ãã«ãªã¹ã«ãªããã£ã大ããªã³ã¼ãããã¨ãããªãã¡ã¯ã¿ãããã¨ãããã³ã¹ããé常ã«å°ããæ¸ãã
ãªã¼ãã³ã§ãããã¨
Alice ãã㨠Bob ããããããããããåãããã¦ãã®å¤æ´ãå ããããã®ã ãã¨ãããã¨ãä»ã®äººã«åããå½¢ã§æ®ããã¨ãããé常ã«è¯ãã
ä¸è¨ã®ãå¤æ´ãã確èªãã¨ãã³ããããããã§ã¯ãAlice ãã㨠Bob ããã®éã§ã¯å
±éèªèã®ç¢ºèªãã¨ããããããã« Charlie ãããã¾ãå¤æ´ãããã¨æã£ãå ´åã«ããã®æã®ããåããããããããããªããã§ãèãããããã¨ãéãã¨æãããã®æ©è½ãæä¾ããã³ã¼ãããã©ãããæå³ã§æ¸ããã¦ããã®ã両人ã®æå³ãããã«ãããã¯ãã ã
ã¾ã¨ã
- ã¡ãããªãããã常ã ã¬ãã¥ã¼ããã
- ãã®ããã«ãä»äºã§ã Pull Request ã使ããã
- ãGitHub ãä»äºã§ä½¿ããã¯ã¢ããã³OKã ã¨æãã¾ãã
- ãéã®ããã¨ãã㯠GitHub Enterprise ãæã£åãæ©ããã¾ãé«ãã§ãã
- ããã§ãªããªã Organization ã§ææãã©ã³ã使ãã®ãããã
- GitHub ã¯ã¡ãã£ã¨... ã¨ãã人㯠Gitlab ãªã¹ã¹ã¡ãMerge Request ã¨ããæ©è½ãããã¾ãã *5
- ãGitHub ãä»äºã§ä½¿ããã¯ã¢ããã³OKã ã¨æãã¾ãã
ã¡ãªã¿ã«ãRedmine 㧠Pull Request çãªãã¨ãä½åº¦ããã£ã¦ã¿ããã©ããã±ããåãã¦å½äººå士ã§ç®¡çããã®ã¯ã§ãããã©ãã©ã®ãã©ã³ãããã©ã®ãã©ã³ãã¸ã©ã® diff ã? ã®ãããªè¨é²ãæ示çã«æ®ãã®ãé£ãããªã¼ã¨æããã
ç¹°ãè¿ãã«ãªãããpatch ã®ããåããã³ã¼ãã¬ãã¥ã¼ããã·ã¹ãã ã«ãã£ã¦å¹ççã«ä½ã³ã¹ãã§è¡ããã¨ãã§ããããã«ãªã£ããã¨ããGit ã®ãGitHub ã®é©å½ã§ããããããéçºããã¼ã«åãè¾¼ãã¨ããã®ã¯é常ã«æå¹ãªæ段ã ã¨æãã
(追è¨) :
git-request-pull ã¨ããã³ãã³ããããäºã¯ã©ã®ç¨åº¦èªç¥ããã¦ããã®ã ããã
ã¡ã¼ã«ã§ã®ããã¨ãã§ãrequest-pull / am ã§ãããã®ããã¨ããããæ©è½ã Git ã«ã¯ããã¾ããã
ã¯ã£ãç¥ããªãã£ãorå ¥éGitãããã§ç¥ã£ã¦ãæ°ããããã©å®å ¨ã«å¿ãã¦ããamã¨ã®é£æºãããããã¦æãªããã®MLã§ã®ããåããåºæ¬ã®å ´åãªã®ããªã¼ã¨æã£ãè¨æ¶ã RT @voluntas: git-request-pull ã¨ããã³ãã³ããããäºã¯ã©ã®ç¨åº¦èªç¥ããã¦ããã®ã ãã
ãªã¹ã¹ã¡:
å
¥éGit (濱é ç´(Junio C Hamano)) - Amazon
*1:ã¨ããã§ã¯å¼ã¶ãã©ãMVCã§ããã¨ããã®ã¢ãã«çãªå ´æã®ãã¨ã¨ãããªãã¸ããªã¯ã©ã¹ã¨ããã¾ãã ãããããããã¤ã¡ã¼ã¸ã
*2:ã¡ãªã¿ã«ãã¡ãã£ã¨æ¨ªéã«ããããã©ãèªåãæ¸ããã³ã¼ãã«å¯¾ãã責任ãã¡ããã¨æã¤ããã«ãã¾ããã
*3:Aliceããããã対å¿ãã¦ãããå ´åããããã ãã©ããã®å ´åAliceããã«ã¨ã£ã¦ã¯å·®ãè¾¼ã¿ã®ä»äºã ããããã¯Aliceããã«ã¨ã£ã¦ã®ã³ã¹ããå¢å¤§ãã
*4:ãã¹ããæ¸ãã¦ãããã¨ããã®ãéè¦ã ãã©ãããã¯å¥ã®è©±ã«ãªãã®ã§ä»åã¯å²æ
*5:ãããã横éã«ããããã©ãä½åº¦ã Twitter ãªã©ã§è¨ã£ã¦ãããã©ãGitHub ã¯ãã¼ã³ãªã©ã¨ç§°ããããããã¯ãã¯ã¡ããã¡ããã§ã¦ãã¦ãã®ã ãã©ãPull Request ããã GitHub ãèµ·ãããé©å½ã ã¨æãã®ã§ããããç¡ããã®ã¯ GitHub ã¯ãã¼ã³ãªã©ã§ã¯ãªãããã ã® Git ãªãã¸ããªãã¥ã¼ã¯ã¼ã§ããã