You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -34,7 +34,7 @@ Despite the fact that making commit is mandatory when working on a Git repositor
34
34
35
35
### Keep clear history of changes
36
36
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.
38
38
39
39
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.
40
40
@@ -48,12 +48,6 @@ Even with several commits, you can have a clear view of all the changes when mer
48
48
49
49
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.
50
50
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
-
57
51
## When to commit?
58
52
59
53
### 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
66
60
67
61
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.
68
62
69
-
::: callout-caution
70
-
#### Need feedbacks.
71
-
72
-
Need feedbacks.
73
-
:::
74
-
75
63
## How to write a good commit message
76
64
77
65
As a history tracking, a commit message should be concise and clearly explain **what** was done and **why**.
78
66
79
67
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.
80
68
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
+
81
75
### Title
82
76
83
77
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
106
100
`TLF: create overview of AEs`
107
101
:::
108
102
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
+
109
109
### Detail
110
110
111
111
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
114
114
115
115
It should be informative but also concise.
116
116
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
+
117
119
Here is an example of a commit message including a title and the body (detail):
118
120
119
121
::: note
@@ -131,3 +133,32 @@ Here is an example of a commit message including a title and the body (detail):
131
133
132
134
[conventionalcommits.org](https://www.conventionalcommits.org/en/v1.0.0/) gives tips and guidance for writing commit messages.
133
135
:::
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:
0 commit comments