Year: 2025
Type: conference-paper
Abstract: Background: A commit message describes the main code changes in a commit and plays a crucial role in software maintenance. Existing commit message generation (CMG) approaches typically frame it as a direct mapping which inputs a code diff and produces a brief descriptive sentence as output. Aims: Since the raw code diff lacks the context related to the code itself, we intend to supplement the relevant code as input of CMG to generate high-quality and informative commit messages. Method: We propose a contextual code retrieval-based method called C3Gen to enhance CMG by retrieving commit-relevant code snippets from the repository and incorporating them into the model input to provide richer contextual information at the repository scope. In the experiments, we evaluated the effectiveness of C3Gen across various models using four objective and three subjective metrics. Meanwhile, we design and conduct a human evaluation to investigate how C3Gen-generated commit messages are perceived by human developers. Results & Conclusions: By incorporating contextual code into the input, C3Gen enables models to leverage additional information to generate more comprehensive and informative commit messages with greater practical value in real-world development scenarios. Further analysis underscores concerns about the reliability of similarity-based metrics and provides empirical insights for CMG.
Authors: Bo Xiong, Linghao Zhang, Chong Wang, Peng Liang
Institution: Wuhan University
Language: English
Subfield: Information Systems
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
Awards: G3792353997, G5675372752
OpenAlex ID: W7123347339
