Contextual Code Retrieval for Commit Message Generation: A Preliminary Study
Bo Xiong, Linghao Zhang, Chong Wang, Peng Liang

TL;DR
This paper introduces C3Gen, a method that improves commit message generation by retrieving and incorporating relevant code snippets to provide richer context, leading to more informative and practical commit messages.
Contribution
It proposes a novel contextual code retrieval approach for commit message generation, enhancing existing models with repository-wide code context for better quality.
Findings
C3Gen improves the informativeness of generated commit messages.
Incorporating contextual code enhances model performance across multiple metrics.
Human evaluation shows increased developer satisfaction with C3Gen outputs.
Abstract
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. However, we argue that relying solely on the code diff is insufficient, as raw code diff fails to capture the full context needed for generating high-quality and informative commit messages. In this paper, 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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Advanced Text Analysis Techniques
