人é
ããªãã¯gitã«è©³ããã§ãã
ã¯ããGitã«ã€ããŠããªã詳ããç¥ã£ãŠããŸãïŒ
ç§ã¯ãGitã®åºç€ããäžçŽçãªæ©èœãŸã§ãå€ãã®ç¥èãæã£ãŠããŸããäŸãã°ïŒ
- åºæ¬æäœ: ã³ããããããã·ã¥ããã«ããã©ã³ããããŒãžãªã©
- **ããŒãžã§ã³ç®¡ç:**å±¥æŽã®ç¢ºèªãç¹å®ã®ã³ããããžã®æ»ããéå»ã®ããŒãžã§ã³ãšã®æ¯èŒ
- ãªããžããª: ããŒã«ã«ãšãªã¢ãŒããªããžããªã®æŠå¿µãGitHubãªã©ã®ãã¹ãã£ã³ã°ãµãŒãã¹
- ã³ã©ãã¬ãŒã·ã§ã³: è€æ°ã®äººãåæã«éçºãè¡ãéã®ã¯ãŒã¯ãããŒ
å ·äœçã«ã©ã®ãããªGitã«é¢ããæ å ±ãç¥ãããã§ããïŒ äŸãã°ïŒ
- ç¹å®ã®ã³ãã³ãã®äœ¿ãæ¹ã解説ããŠã»ãã
- Gitã®å±¥æŽæäœæ¹æ³ã«ã€ããŠè©³ããç¥ããã
- ã³ã©ãã¬ãŒã·ã§ã³ã«åœ¹ç«ã€Gitã®ææ³ãæããŠã»ãã
質åãããã°ãã§ããã ãäžå¯§ã«çããŸãã
解説(人é)
ããã¯é Œããããªã
人é
cherry-pickã§-m 1
ãã€ããå Žåãšã€ããªãå Žåã®éããç¥ãããã§ã
git cherry-pick
ã³ãã³ã㧠-m 1
ãã€ããã®ãšä»ããªãã®ãšã§ã¯ãã³ãããã®æ±ãæ¹ãç°ãªããããã€ãã®éãããããŸãã
git cherry-pick -m 1
ãšã¯ïŒ
- åäžã®ã³ããããããã¯ãã: æå®ããcommit IDã«å¯Ÿå¿ããææ°ã®ã³ããããåã蟌ã¿ãŸããã³ãããã¡ãã»ãŒãžããã®ãªãªãžãã«ã®ãã®ãšããŸãã
- ãã©ã³ãã®è€éåãæãã:
-m
ãªãã·ã§ã³ã§ãè€æ°ã®ã³ããããããã¯ããå Žåã«ãå ã®ã³ãããããªãŒã®æ§é ãåæ ãããåäžã®æ°ããã³ããããšããŠããã¯ãè¡ããŸãã
git cherry-pick
( -m 1
ãã€ããªã ) ãšã¯ïŒ
- å ã®ã³ãããããªãŒã«åŸã£ãŠããã¯ãã: ç¹å®ã®ã³ããããšãã®çŽå±ã®åã³ãããããã¹ãŠæŸããŸãã
- ãã©ã³ãã®è€éåãä¿é²ãã: å ã®ã³ãããå±¥æŽãåæ ããããã詳现ãªãã©ã³ãæ§é ãã§ããŸãã
äŸïŒ
# -m 1 ãæå®ããå Žå
git cherry-pick -m 1 commit_id
# `-m` ãªãã·ã§ã³ãªãã®å Žå
git cherry-pick commit_id
ã©ã¡ãã䜿ãã¹ããïŒ
-m 1
ã䜿ã: åäžã®ã³ããããåãå ¥ãããå Žåããã©ã³ãæ§é ãã·ã³ãã«ã«ä¿ã¡ããå Žå-m 1
ã䜿ããªã: ç¹å®ã®å€æŽå 容ã«å ããŠããã®åšèŸºã®å€æŽã欲ããå Žåãå ã®ã³ãããããªãŒãåæ ããæ°ãããã©ã³ããäœãããå Žå
ã©ã¡ãã䜿ããã¯ãããªãã®ç¶æ³ãšçšéã«ãã£ãŠç°ãªããŸãã
解説(人é)
ãªããéããšæããã ããªã-m 1
ã¯ããŒãžã³ããããcherry-pickããå Žåã«æå®ãããªãã·ã§ã³ã ã£ããããããŒãžã³ãããã§ã¯ãªãåäžã®ã³ãããã ã£ãã-m 1
ãã€ããªãã
人é
ãªããåãã£ããããªåãããªããããªâŠ
ããã¯ãšããããrebaseãšmergeã®éãã説æããŠããããŸãã
ç解ããããããã«ãååž°åã®äŸã䜿ã£ãŠã¿ãŸãããïŒ
Imagine: ããªãã¯ãã¡ã€ã³ããã©ã³ãã§éçºãé²ããŠããããããŠããªãã®ä»²éãå¥ã®ããµã€ãããã©ã³ãã§ç¬èªã®å€æŽãå ããŠããããããããããããã®ä»äºã«éäžããŠé 匵ã£ãŠããç¶æ ã§ãã
rebase ãš merge ã®éãïŒ
merge ã¯ãããµã€ãããã©ã³ãã®å 容ããã¡ã€ã³ããã©ã³ãã«æ··ããã€ã¡ãŒãž:
- ããµã€ãããã©ã³ãã«ããå€æŽããæ°ãã«ãã¡ã€ã³ããã©ã³ãã«åã蟌ãããšãæå³ããŸãããŸãã§äºã€ã®ã¹ããªãŒã ãäžã€ã«åæµããããããªæãã
"ã¡ã€ã³" --- "ãã€ã³ãA" --- "ãã€ã³ãB" \ "ãµã€ã" --- "ãã€ã³ãC" ---- merge-----> "ã¡ã€ã³" /\ ^ | \--------------/ | | -----v | "ãã€ã³ãD" (mergeããåŸã®æ°ãããã€ã³ã)
rebase ã¯ãããµã€ãããã©ã³ãããã¡ã€ã³ããã©ã³ãã«ç§»åãããã€ã¡ãŒãž:
- ããµã€ãããã©ã³ãã®å€æŽãããŸãã§æ°ããå ŽæãžåŒã£è¶ãããã«ããã¡ã€ã³ããã©ã³ãã®å é ã«çœ®ãæããŸãããã®æãããµã€ãããã©ã³ãã®å 容ã¯ãã¡ã€ã³ããã©ã³ãã«å®å šã«çµ±åããã圢ã«ãªããã
"ã¡ã€ã³" --- "ãã€ã³ãA" --- "ãã€ã³ãB" ---- rebase-----> "ã¡ã€ã³" \ ^ "ãµã€ã" --- "ãã€ã³ãC" -----> "ãã€ã³ãD" (rebaseåŸã®æ°ãããã€ã³ã)
ã¡ãªãããšãã¡ãªãã:
- merge: ã·ã³ãã«ã§ç解ãããããå€æŽå±¥æŽãæ確ã«ãããããã ãããã©ã³ãã®æ§é ãè€éã«ãªããã¡ã§ãã¬ãã¥ãŒã远跡ãããç ©éã«ãªãå Žåãããã
- rebase: ãã©ã³ãã®æ§é ããã£ãããããããããããä¿ã€ãäžæ¹ãå€æŽå±¥æŽã¯å ã®æµããšã¯ç°ãªããããç解ãã¥ããå ŽåããããããªããŒã¹æäœãã¹ã«ããåé¡ãçºçããããã§ãã
䜿ãåã:
- merge: è€æ°ã®éçºè ãåæã«éçºãé²ãããããããç¬ç«ããæ©èœãå®è£ ããå Žåãªã©
- rebase: å人ã§éçºãé²ããå®æçã«ã¡ã€ã³ãã©ã³ãã«èªåã®å€æŽãçµ±åãããå Žåãªã©
解説(人é)
åã£ãŠãïŒïŒ ãŸãæŠèŠã¯åã£ãŠããâŠ
人é
githubãgitlabã®squash and mergeã¯äœããã£ãŠããã§ãããã
GitHub ã GitLab ã® âSquash and mergeâ ã¯ããã©ã³ãã®å 容ããŸãšãã䟿å©ãªæ©èœã§ãã
ã€ã¡ãŒãžãšããŠã¯ããè€æ°ã®ã³ãããã1ã€ã«ãŸãšããŠãã¡ã€ã³ãã©ã³ãã«çµ±åãããåäœããããšèããããŸãã
å ·äœçã«ã¯ïŒ
- è€æ°åã®ã³ããã: ããªãããµã€ããã©ã³ãã§äœæ¥ããããã€ãã®å€æŽãå ããŠã³ããããç¹°ãè¿ãããšããŸãã
- Squash and merge ãã¿ã³: ãµã€ããã©ã³ããã¡ã€ã³ãã©ã³ãã«çµ±åããéããSquash and mergeããã¿ã³ãã¯ãªãã¯ããŸãã
- èªåçãªå䜵åŠç: GitLab ã GitHub ãèªåçã«ããµã€ããã©ã³ãå ã®ãã¹ãŠã®ã³ãããå 容ã1ã€ã®æ°ããã³ãããã«ãŸãšããŠãããŸãã å ã®ã³ãããã¡ãã»ãŒãžã¯ãã®ãŸãŸäœ¿ãããå Žåããæ°ãã«ãŸãšããã³ãããã®ã¡ãã»ãŒãžãå ¥åã§ããå Žåãªã©ãããŒã«ã«ãã£ãŠç°ãªãç¹ããããŸãã
- ã¡ã€ã³ãã©ã³ããžã®çµ±å: æåŸã«ããã®ãŸãšãããã1ã€ã®ã³ãããããã¡ã€ã³ãã©ã³ãã«åã蟌ãŸããŸãã
ã¡ãªããïŒ
- ã·ã³ãã«å: ã¡ã€ã³ãã©ã³ãã®å±¥æŽã¯ããµã€ããã©ã³ãã§è€æ°åè¡ã£ãå€æŽããŸãšããŠ1ã€ãšããŠè¡šç€ºãããããããããã£ãããšããç¶æ ã«ãªããŸãã
- èªã¿ããã: å€æŽå±¥æŽããããããããäžç®ã§ã©ããªå€æŽãè¡ããããææ¡ãããããªããŸãã
ãã¡ãªããïŒ
- 詳现ãªè¿œè·¡å°é£å: å ã ã®åã³ãããã®è©³çŽ°ãªå 容ã远跡ããã®ãé£ãããªããŸãã
䜿ãåãã®ãã€ã³ã:
- ããŒã å ã§å ±æããããã©ã³ã: ã¡ã€ã³ãã©ã³ããªã©ãä»ã®éçºè ãèŠãããšãæ³å®ããå Žåã«ã¯ãSquash and mergeããããããã§ãã
- å人ã®å®éšããããã°: å€æŽå±¥æŽã现ããèšé²ãããå Žåã¯ãåç¬ã§äœæ¥ããéããmergeãã®æ¹ãé©ããŠããŸãã
解説(人é)
ãŸãããã¯åã£ãŠããšæããã
人é
squash and mergeã®åäœã«ã€ããŠãgithubãšgitlabã§éãã¯ãããŸãã
GitHub ãš GitLab ã® âSquash and mergeâ ã®åäœã«ã¯ãããã€ãã®éãããããŸãã
äž»ãªéãïŒ
ã³ãããã¡ãã»ãŒãž:
- GitHub: ãŸãšããããã³ãããã«æ°ããã¡ãã»ãŒãžãå ¥åã§ããŸããå ã®ã³ãããã¡ãã»ãŒãžã¯å šãŠå«ããŸããã
- GitLab: ãŸãšããããã³ãããã«æ°ããã¡ãã»ãŒãžãå ¥åã§ããã ãã§ãªããå ã®ã³ãããã¡ãã»ãŒãžããã¹ãŠå«ããããšãå¯èœã§ãããã®å Žåãéå»ã®å€æŽå 容ãã²ãšã€ã®ã³ã¡ã³ããšããŠãŸãšããããŸãã
ãã¬ãã¥ãŒæ©èœ:
- GitHub: å䜵ããåã«ããŸãšããããã³ãããã®å·®åã衚瀺ãããã¬ãã¥ãŒç»é¢ããããŸãã
- GitLab: ã¹ã¯ã¯ãã·ã¥ãããåŸã®æçµçãªå±¥æŽã確èªã§ãããã¬ãã¥ãŒæ©èœããããŸãã
ã³ãããç·šé:
- GitHub: Squash and merge åŸãæ°ããã³ããããç·šéã§ããŸãã
- GitLab: Squash and merge åŸãæ°ããã³ããããç·šéããæ段ã¯ãããŸãããå€æŽãå ããå Žåã¯åããŒã¹ããå¿ èŠããããŸãã
ãã®ä»ã®éã:
- GitLab 㯠GitHub ããããSquash and mergeãã®æ©èœã«åªããŠããããã詳现ãªå¶åŸ¡ãšã«ã¹ã¿ãã€ãºãå¯èœã§ãã
- äŸãã°ãGitLab ã§ã¯ããsquash and mergeãæã«èªåçã«ã³ãããã¡ãã»ãŒãžãçæããããç¹å®ã®ã³ããããé€å€ãããªã©ã®èšå®ãå¯èœã§ãã
ã©ã¡ãã䜿ãã¹ããïŒ
GitHub ãš GitLab ã®äž¡æ¹ãšããSquash and mergeãã¯äŸ¿å©ãªæ©èœã§ãããå ·äœçãªäœ¿ãåãã¯ããŒã ã®å¥œã¿ãã¯ãŒã¯ãããŒã«ãã£ãŠç°ãªããŸãã
- ãŠãŒã¶ãŒãã¬ã³ããªãŒãªæäœ: GitHub ãããããã§ãã
- 詳现ãªå¶åŸ¡ãšã«ã¹ã¿ãã€ãº: GitLab ãããããã§ãã
解説(人é)
ããŒããŸãããã€ã¯å®éã«githubãšgitlabã䜵çšããŠãªããããåãããªããã ãããªãå©çšè èŠç¹ã§ã¯ãããŒãžã³ããããåºçŸãããã©ããã®éãããããå éšã§ã¯ãã£ãšéãã®ãããããªããã