Commit messages are crucial to software development and maintenance, allowing developers to track code changes and collaborate effectively. Automating commit message generation (CMG) reduces developers’ manual effort and facilitates program comprehension and software maintenance. Previous approaches typically generate commit messages based solely on code changes, overlooking the valuable context provided by commit history. Moreover, different developers have varying background knowledge and work on different tasks, leading to diverse commit message styles. The commit history provides important context when developers handle different software development tasks across different repositories, yet its potential in CMG remains underexplored. To fill this gap, we propose a novel paradigm named HisRag , which retrieves relevant commit messages from commit history and uses them to enhance existing CMG approaches, improving the quality and relevance of generated commit messages. Extensive experiments showed that HisRag significantly enhances the performance of various CMG approaches. The average improvements on the B-NORM, BLEU, ROUGE-L, METEOR, Log-MNEXT, and BRSA are 65%, 78%, 38%, 42%, 37%, and 12%, and the human evaluation results indicate that HisRag can improve CMG approaches in terms of informativeness, conciseness, expressiveness, and acceptance rate, providing meaningful insights for future research on history retrieval-augmented commit message generation and practical application.
Lan et al. (2026) studied this question.