ã¯ããã«
ããã¯Folioã¢ããã³ãã«ã¬ã³ãã¼2024ã®14æ¥ç®ã®è¨äºã§ãã
ä»åã¯ãç°¡æçãªConventional Commitsãå®ç¾ããããã® zsh-select-commit-prefix
ã¨ããzshãã©ã°ã¤ã³ã«ã¤ãã¦è©±ãã¾ãã
ã¢ãã¹ãã©ã¯ã
æ¬ç¨¿ã§ã¯ãã½ããã¦ã§ã¢éçºã«ãããã³ãããã¡ãã»ã¼ã¸ä»æ§ãConventional Commitsããç°¡ç´ åããæ¥å¸¸çãªå©ç¨ã§ã®å¹çåä¸ãå³ãzshãã©ã°ã¤ã³ã®è¨è¨ã¨å®è£ ã«ã¤ãã¦è¿°ã¹ããæ¢åã®Conventional Commitsé¢é£ãã¼ã«ã¯ã詳細ãªæ§æããªãã¸ããªåä½ã®è¨å®ãæ±ãããã®ãå¤ããå人å©ç¨ãç°¡æãªããã¸ã§ã¯ãã«ã¯éå°ã¨ãªãå¾ããæ¬ç 究ã§ã¯ãzsh ãã©ã°ã¤ã³ã¨ãã¦è»½éãªãã¼ã«ãéçºãã1è¡å½¢å¼ã®ã¡ãã»ã¼ã¸ä½æãNode.jsã©ã³ã¿ã¤ã ã®æé¤ãä»ãã¼ã«ã¨ã®ç«¶ååé¿ãå®ç¾ãããææ¡ãã¼ã«ã¯ãç°¡æ½ãã¤ç´æçãªæä½æ§ãåãã¦ãããç¹ã«å人ããã¸ã§ã¯ããå°è¦æ¨¡ãã¼ã ã§ã®å©ç¨ã«é©ãã¦ãããã¾ããæ¡å¼µå¯è½æ§ãèæ ®ããè¨è¨ã«ãããä»å¾ã®AIçæã¡ãã»ã¼ã¸å¯¾å¿ãä»ãã¼ã«ã¨ã®çµ±åãè¦æ®ãã¦ãããæ¬ç¨¿ã§ã¯ãè¨è¨èæ¯ãæè¡ç工夫ãå®è£ æ¹æ³ãããã¦ä»å¾ã®å±æã«ã¤ãã¦è©³ç´°ã«è§£èª¬ããã generated by ChatGPT
1.ConventionalCommitsã¨ã¯
Conventional Commitsã¯ã人éã¨æ©æ¢°ãèªã¿ããããæå³ã®ããã³ãããã¡ãã»ã¼ã¸ã«ããããã®ä»æ§ ã§ãããã®ä»æ§ã¯ãAngularããã¸ã§ã¯ãã®ã³ãããã¡ãã»ã¼ã¸è¦ç´ Angular Commit Guidelines ã«åºã¥ãã¦è¨è¨ããã¦ãã¾ãã
ãã®ä»æ§ã«ã¯ãããã MUST/MUST NOT/REQUIRED/SHALL/SHALL NOT/SHOULD/SHOULD NOT/RECOMMENDED/MAY/OPTIONALã®åãã¼ã¯ã¼ããæå®ããã¦ããããã®ä»æ§ã®è¦ä»¶ã¬ãã«ãå®ç¾©ããã¦ãã¾ãã
ããã§ã¯å ·ä½çãªä»æ§ã«ã¤ãã¦ã®èª¬æã¯çãã¾ãã Conventional Commits ã®å ·ä½çãªå©ç¨æ¹æ³ãé©ç¨ã¯O2æ°ã®ãã¡ãã®ã¹ã©ã¤ããåãããããã§ã
コミットメッセージ規約 「Conventional Commits」を導入してみよう! / Let's use Conventional Commits - Speaker Deck
Conventional Commitsã¯ãéçºè éã§ã³ãããã®ç®çãå 容ãæ確ã«ä¼ããããã«éè¦ã§ãã
Conventional Commits 1.0.0
Angular Commit Guidelines
Git Commit Message Conventions · GitHub
2.Conventional Commitsã«å¯¾å¿ãããã¼ã«
2.1 å°ç¨ãã¼ã«
2.1.1 conventional-commits
PHPã©ã¤ãã©ãªã§ãããã³ãããã¡ãã»ã¼ã¸ã®ä½æããã³æ¤è¨¼ãè¡ãã¾ã
https://github.com/ramsey/conventional-commits
2.1.2 cz-cli
czã³ãã³ããéãã¦ã対話形å¼ã§ã³ãããã¡ãã»ã¼ã¸ãçæãã¾ã
https://github.com/commitizen/cz-cli
2.2 commit message ã® checkã»lint tool
ãã®ä»commit messageã«é¢é£ãããã¼ã«ãç´¹ä»ãã¾ãã
2.2.1 commitlint
commitlintã¯ãã³ãããã¡ãã»ã¼ã¸ãè¦ç´ã«æºæ ãã¦ããããLintãããã¼ã«ã§ã
2.2.2 opencommit
AIãæ´»ç¨ããã³ãããã¡ãã»ã¼ã¸ãèªåçæãè¡ããã¼ã«ã§ã
2.2.3 gitmoji
çµµæåãæ´»ç¨ãã¦ã³ãããã¡ãã»ã¼ã¸ã«è¦è¦çãªæ å ±ãä»å ãããã¼ã«ã§ã
3.ç¾ç¶ã®ãã¼ã«ã®èª²é¡
ç¾å¨ä½¿ç¨ããã¦ããConventional Commitsé¢é£ãã¼ã«ã«ã¯ã以ä¸ã®ãããªèª²é¡ãåå¨ãã¾ãã
ï¼. ã©ã³ã¿ã¤ã ä¾åæ§
å¤ãã®ãã¼ã«ãNode.jsãå°å ¥ããå¿ è¦ããããNode.js ãå©ç¨ããªãRepositoryã§ããã¼ã«ã®ããã«Node.jsã®è¨å®ãããå¿ è¦ãããã¾ãã
ï¼. ãªãã¸ããªåä½ã®è¨å®
toolã®è¨å®ããªãã¸ããªã«ç´ã¥ããã¨ãå¤ããå人ã¬ãã«ã§ã®ã«ã¹ã¿ãã¤ãºãé£ããã§ãã
ï¼. pre-commitããã¯ã¸ã®ä¾å
lintãå«ããã¼ã«ã®å ´åpre-commitæã«lintãè¡ãå ´åãå¤ããæå³çã«è¦ç´å¤ã®ã³ããããè¡ãéã«git commit --no-verify
ãªã©ã§lintãåé¿ãã使ç¨ããå¿
è¦ãããæéããããã¾ãã
ï¼. ã³ãããè¦ç´ã®å³æ ¼ã
æ¥åã趣å³ã®éçºã§ã¯ã3è¡æ§æã®è©³ç´°ãªã³ãããã¡ãã»ã¼ã¸ã¯éå°ã§ããã1è¡æ§æã®ç°¡æãªå½¢å¼ãæã¾ããå ´åãããã¾ããæ¥åã ã¨PRã®discriptionãã社å wikiã«è©³ç´°ä»æ§ãã¾ã¨ãããªã©commit message 以å¤ã«æ å ±éç´ãè¡ããã¨ãå¤ãã§ãã
ï¼. ä»ãã¼ã«ã¨ã®ç«¶å
対話å¼ã®ãã¼ã«ã®å ´åã«ä»ã®Gité¢é£ãã¼ã«ï¼ä¾: tigãscm_breezeï¼ã¨ç«¶åããå©ç¨ãå¶ç´ãããã±ã¼ã¹ãããã¾ããã¾ãopencommitãgitmojiãªã©ã®commité¢é£ã®ãã¼ã«ãå©ç¨ããã¨è¦ç´ã«åããªããªã£ã¦ãã¾ãåé¡ãããã¾ãã
4.æ¹åæ¡ã¨å®ç¾æ¹æ³
ãããã®èª²é¡ã解決ããããã«ã以ä¸ã®æ¹åæ¡ãææ¡ãã¾ãã
ï¼. å人è¨å®ã«ç´ã¥ããã¼ã«
ãªãã¸ããªè¨å®ã«ä¾åããªãè¨è¨ã«ãããã¨ã§ Repositoryã§ã®è¨å®ãä¸è¦ã«ãã¾ãã
ï¼. 1è¡å½¢å¼ã®ã³ãããã¡ãã»ã¼ã¸
Conventional Commitsã®ä»æ§ã§MUSTã§ããPrefixã®ã¿ãæå®ããããã«ããå¿ è¦ã«å¿ãã¦ã¡ãã»ã¼ã¸ã追å ããå½¢å¼ãæ¡ç¨ãã¾ãã
ï¼. ã©ã³ã¿ã¤ã ã®ç°¡ç¥å
zshãã©ã°ã¤ã³ã¨ãã¦å®è£ ããNode.jsã©ã³ã¿ã¤ã ã®ä¾åãæé¤ãã¾ãã
ï¼. ä»ãã¼ã«ã¨ã®ç«¶ååé¿
ä»»æå©ç¨å¯è½ãªè¨è¨ã¨ããæ¢åã®ãã¼ã«ãã¨ã¤ãªã¢ã¹è¨å®ã¨å¹²æ¸ããªãããã«ããã
5. ä½æãããã¼ã«ã®ç´¹ä»
ä½æãããã¼ã«ãzsh-select-commit-prefixãã¯ä»¥ä¸ã®æ©è½ãæã¡ã¾ãã
zshãã©ã°ã¤ã³ å½¢å¼
Sheldonãªã©ã®ãã©ã°ã¤ã³ããã¼ã¸ã£çµç±ã§å°å ¥å¯è½ã§ãã
Prefixã®é¸æ
pecoã使ç¨ãã¦Prefixãé¸æãããã®çµæãã³ãããã¡ãã»ã¼ã¸ã«åæ ãã¾ãã
çµ±åæ§
Prefixãé¸æå¾ãgit.default.editor ã§æå®ããã¨ãã£ã¿ãéãcommit messageã®ç·¨éãã§ãã¾ãã
åä½ä¾
ã³ãã³ããå®è¡ã prefixã é¸æãã㨠git commit æã¨åæ§ã® git.default.editor ã§æå®ããã¨ãã£ã¿ã表示ãããé常ã®ç·¨éæä½ãå¯è½ã¨ãªãã¾ãã
ã¹ã¯ã·ã§
6. æè¡çãªå·¥å¤«
以ä¸ã®ã³ãã³ãã«ãããæå®ããã¡ãã»ã¼ã¸ã渡ãã¤ã¤ãã¨ãã£ã¿ãéããã¨ãã§ãã¾ãã
$ git commit -e -m "${prefix}: "
7. ä»å¾ã®å±æ
以ä¸ã®æ©è½è¿½å ãæ¤è¨ãã¦ãã¾ãã
opencommit対å¿
AIçæã¡ãã»ã¼ã¸ãçµã¿è¾¼ãæ©è½ã®è¿½å
$git commit -e -m "${prefix}: ${generatedMessage}"
ã®ããã«æå®ããã° çµ±åå¯è½ã§ãã
- tig対å¿
git-commit--select-prefix
ã tig
ã§å©ç¨ããã¦ã¼ã¶å®ç¾©é¢æ°ãä½æããã°çµ±åå¯è½ã§ãã
8. çµè«
æ¬ç¨¿ã§ã¯ãConventional Commitsãç°¡æåããããã®zshãã©ã°ã¤ã³ã®ä½æã«ã¤ãã¦è©±ãã¾ããã
ãã®ãã¼ã«ã¯ãå人å©ç¨ã«é©ããæè»æ§ãæã¡ã¤ã¤ãæ¢åãã¼ã«ã¨ã®å¹²æ¸ãæå°éã«æããè¨è¨ã¨ãªã£ã¦ãã¾ãã
9. ãããã«
ããå°ãã¾ã¨ããªå 容ã®è¨äºãæ¸ããã¨ãã¦ããã®ã§ãã諸ã ã§ã½ããã£ãããã«ã代æ¡ã§ãã®è¨äºãå·çãã¾ããã
å»å¹´ã¯å¤§é å»ãããã®ã§ä»å¹´ã¯æ¥ä»éãã«æ稿ã§ãã¦ããã¨ãã¦ãã¾ãã