Gitとは
バージョン管理ツールのことです。バージョンごとに管理することができるので、バグが発生した際にも戻ることができるのはよいですね。
なぜこれをテーマに?
インターン先で、Gitの小さなルールが暗黙的に浸透していたので、おさらいしておくのがよいと思いました。
3行で記述する
1行目: 変更内容の要約(タイトル、概要)
2行目: 空白
3行目: 変更した理由(内容、詳細)
↑ このルールが圧倒的に浸透しているようです。
改行なしコミット
Derezz the master control program MCP turned out to be evil and had become intent on world domination. This commit throws Tron's disc into MCP (causing its deresolution) and turns it back into a chess game.
改行コミット
Derezz the master control program MCP turned out to be evil and had become intent on world domination. This commit throws Tron's disc into MCP (causing its deresolution) and turns it back into a chess game.

Gitのコミットメッセージをうまく作成する7つのルール | NHN Cloud Meetup
この記事は、Chris BeamsのHow to Write a Git Commit Messageブログの内容を簡単にまとめた資料で、翻訳・編集して、役に立つ内容を追加したものです。 Gitのコミットメッセージをうまく作成すべき理由 な...
改行がされているほうが圧倒的に読みやすい!!!!
1行目はどう書くの?
どの系統のコミットで、何をやったのかをライトに記入するのがベスト?
- fix:バグ修正
- hotfix:クリティカルなバグ修正
- add:新規(ファイル)機能追加
- update:機能修正(バグではない)
- change:仕様変更
- clean:整理(リファクタリング等)
- disable:無効化(コメントアウト等)
- remove:削除(ファイル)
- upgrade:バージョンアップ
- revert:変更取り消し etc….
update: 〇〇ファイルのバージョンをアップ
↑ こんなかんじなのかな
2行目は何を書く
かかない! → これ重要です。
3行目は何を書く
理由をベースに書いていきます。Readme等のチケットと連携している場合はここで紐付けするのがよいようです!!
これもライトに書いたり・ヘビーに書いたりすごく分かれそうな感じがします。
ライト: refs#203 SQLに削除項目が追加されていないために追加しました。
ヘビー:https://meetup-jp.toast.com/839
Simplify serialize.h's exception handling Remove the 'state' and 'exceptmask' from serialize.h's stream implementations, as well as related methods. As exceptmask always included 'failbit', and setstate was always called with bits = failbit, all it did was immediately raise an exception. Get rid of those variables, and replace the setstate with direct exception throwing (which also removes some dead code). As a result, good() is never reached after a failure (there are only 2 calls, one of which is in tests), and can just be replaced by !eof(). fail(), clear(n) and exceptions() are just never called. Delete them.
このコミットメッセージはすごいですね。エンジニアって言語化能力めちゃ求められている笑
以上、Gitコミットメッセージ云々でした。少しずつ実務を意識したコミットができるようになりたい!
コメント