Skip to content

Commit bae201a

Browse files
committed
Updates after review
1 parent 90f08c3 commit bae201a

File tree

1 file changed

+45
-14
lines changed

1 file changed

+45
-14
lines changed

site/posts/how-to-commit/index.qmd

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "How to write a good commit message"
3-
subtitle: "Keep easy trackchanges history for your project"
3+
subtitle: "Keep easy track changes history for your project"
44
author: "alex"
55
date: "2025-08-22"
66
categories: [git, version-control, revision-history]
@@ -34,7 +34,7 @@ Despite the fact that making commit is mandatory when working on a Git repositor
3434

3535
### Keep clear history of changes
3636

37-
Commonly, each program has a header that contains a *"Revision history"* part. Git commits can easily replace this part because it contains the main information of a classic revision history message (author, date and reason for change), associated to the full files comparisons, such as a before/after view.
37+
In traditional approaches, each program has a header that contains a *"Revision history"* part. Git commits can easily replace this part because it contains the main information of a classic revision history message (author, date and reason for change), associated to the full files comparisons, such as a before/after view.
3838

3939
All the changes of a single commit are stored in the same place. It means if you work on a single task that request to modify several programs, you can summarize the changes within one message. You do not need to open each separated files one by one to look at what was done, when, and by who.
4040

@@ -48,12 +48,6 @@ Even with several commits, you can have a clear view of all the changes when mer
4848

4949
As Git is a version control software, and each commit is a snapshot done at a current state, it is easy to go back to a previous version of a branch using commit IDs.
5050

51-
::: callout-caution
52-
#### Need feedbacks - hash
53-
54-
I think talking about `git checkout` and `git reset` here is not useful. Maybe another blog post could be interesting. What do you think?
55-
:::
56-
5751
## When to commit?
5852

5953
### Commit one file at a time or several?
@@ -66,18 +60,18 @@ In the case of a debugging task over several files, one commit message per file
6660

6761
When a change on a program affects the behavior of other programs that also needs to be updated, one commit for all the modifications can be done. Also when you decide to modify both a program and the associated documentation.
6862

69-
::: callout-caution
70-
#### Need feedbacks.
71-
72-
Need feedbacks.
73-
:::
74-
7563
## How to write a good commit message
7664

7765
As a history tracking, a commit message should be concise and clearly explain **what** was done and **why**.
7866

7967
It is important to have good commit messages because, as mentioned above, it can replace a classic track change history. The goal is to have messages that will help understanding the changes and will help during the quality control, review or audit steps.
8068

69+
::: callout-tip
70+
#### Consolidate all commits of a branch
71+
72+
Even with several commits, you can have a clear view of all the changes when merging to the source branch.
73+
:::
74+
8175
### Title
8276

8377
The title should be very short (around 50 characters) and explain **what was done** on which file(s) (if relevant).
@@ -106,6 +100,12 @@ Using tags that to identify the location of changes can also be an option, such
106100
`TLF: create overview of AEs`
107101
:::
108102

103+
::: callout-tip
104+
#### Keywords and source code management platforms
105+
106+
So websites such as GitHub are able to recognize some keywords such as `closes` in the title, that will automatically perform an action on the issue or branch (for instance, `closes` will close the issue).
107+
:::
108+
109109
### Detail
110110

111111
The detail explains **why** the commit needed to be done, the methodological or technical context, or any relevant information that needs to understand the commit.
@@ -114,6 +114,8 @@ It should contains, when relevant, the source (such as a new version of the stat
114114

115115
It should be informative but also concise.
116116

117+
Using source code management platforms (GitHub, GitLab, BitBucket, etc) allows a direct link to issues in the title or detail of a commit (for instance `Linked to #35`)
118+
117119
Here is an example of a commit message including a title and the body (detail):
118120

119121
::: note
@@ -131,3 +133,32 @@ Here is an example of a commit message including a title and the body (detail):
131133

132134
[conventionalcommits.org](https://www.conventionalcommits.org/en/v1.0.0/) gives tips and guidance for writing commit messages.
133135
:::
136+
137+
::: callout-tip
138+
#### Using AI to improve commits
139+
Tools such as GitHub Copilot can help to write a good commit message by reviewing a branch and the updated done.
140+
:::
141+
142+
## Examples of bad commit messages
143+
144+
### Single keyword
145+
146+
A message such as `fix` with no addition or detail is too vague. It is not possible to understand directly which file has been fixed and why.
147+
148+
### Too wordy title
149+
150+
The following title is way too long and difficult to read easily:
151+
152+
`
153+
Update participant demographics summary dataset (ADSL) to include additional needed variables for geographical regions groups requested during the study team meeting on September 1st 2025 following the last version (1.2) of the SAP.
154+
`
155+
156+
A better way would be to have a title like this one:
157+
158+
`Add ADSL.REGION1(N)`
159+
160+
And a detailed description such as this one:
161+
162+
`Following study team meeting (01-SEP-2025).`
163+
164+
`Done as per SAP (v1.2).`

0 commit comments

Comments
 (0)