{"id":13571,"date":"2023-12-13T10:00:00","date_gmt":"2023-12-13T01:00:00","guid":{"rendered":"https:\/\/www.gigas-jp.com\/appnews\/?p=13571"},"modified":"2023-12-12T19:26:17","modified_gmt":"2023-12-12T10:26:17","slug":"revolutionizing-commit-messages-with-ai","status":"publish","type":"post","link":"https:\/\/www.gigas-jp.com\/appnews\/archives\/13571","title":{"rendered":"Revolutionizing Commit Messages with AI"},"content":{"rendered":"\n<p>In the world of software development, commit messages play a crucial role in tracking changes, understanding the evolution of code, and collaborating effectively within a team. However, writing meaningful commit messages can be a tedious task, often resulting in generic or uninspiring messages. This is where <a href=\"https:\/\/github.com\/di-sukharev\/opencommit\" data-type=\"URL\" data-id=\"https:\/\/github.com\/di-sukharev\/opencommit\">OpenCommit <\/a>comes into play, aiming to eliminate lame commits with the power of artificial intelligence.<\/p>\n\n\n\n<p><em>Auto-generate Meaningful Commits in 1 Second<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/di-sukharev\/opencommit\" data-type=\"URL\" data-id=\"https:\/\/github.com\/di-sukharev\/opencommit\">OpenCommit <\/a>is an innovative tool that leverages AI to automatically generate meaningful commit messages for your code changes. The primary goal is to enhance the quality of commit messages, making them more descriptive and relevant. By doing so, OpenCommit contributes to better code documentation and collaboration.<\/p>\n\n\n\n<p><strong>Getting Started with OpenCommit<\/strong><\/p>\n\n\n\n<p>Setting up <a href=\"https:\/\/github.com\/di-sukharev\/opencommit\" data-type=\"URL\" data-id=\"https:\/\/github.com\/di-sukharev\/opencommit\">OpenCommit <\/a>is a breeze, and you can start using it as a command-line interface (CLI) tool. The process involves a few simple steps:<\/p>\n\n\n\n<p>1. Install OpenCommit Globally<\/p>\n\n\n\n<p><code>&nbsp;&nbsp; npm install -g opencommit<\/code><\/p>\n\n\n\n<p>2. Obtain Your OpenAI API Key<\/p>\n\n\n\n<p>&nbsp;&nbsp; Get your API key from OpenAI and ensure that you add your payment details to enable API functionality.<\/p>\n\n\n\n<p>3. Set API Key in OpenCommit Config<\/p>\n\n\n\n<p><code>&nbsp;&nbsp; oco config set OCO_OPENAI_API_KEY=&lt;your_api_key&gt;<\/code><\/p>\n\n\n\n<p>&nbsp;&nbsp; Your API key is stored locally in the ~\/.opencommit config file.<\/p>\n\n\n\n<p><strong>Usage Example<\/strong><\/p>\n\n\n\n<p>Once OpenCommit is set up, you can use it to generate commit messages for your staged changes. Here&#8217;s a quick example:<\/p>\n\n\n\n<p>Stage your changes<\/p>\n\n\n\n<p><code>git add &lt;files...&gt;<\/code><\/p>\n\n\n\n<p>Generate a commit message with OpenCommit<\/p>\n\n\n\n<p><code>opencommit<\/code><\/p>\n\n\n\n<p>Alternatively, you can use the `oco` shortcut:<\/p>\n\n\n\n<p>Stage your changes<\/p>\n\n\n\n<p><code>git add &lt;files...&gt;<\/code><\/p>\n\n\n\n<p>Generate a commit message with OpenCommit using the shortcut<\/p>\n\n\n\n<p><code>oco<\/code><\/p>\n\n\n\n<p><strong>Configuration Options<\/strong><\/p>\n\n\n\n<p>OpenCommit provides various configuration options to tailor the generated commit messages according to your preferences. These configurations include:<\/p>\n\n\n\n<p><strong>Local per repo configuration<\/strong><\/p>\n\n\n\n<p>Create a `.env` file in your repository and set OpenCommit config variables such as API key, max response tokens, base path to OpenAI API, description, emoji usage, model selection, language, message template, and prompt module.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>OCO_OPENAI_API_KEY=&lt;your OpenAI API token&gt;\nOCO_OPENAI_MAX_TOKENS=&lt;max response tokens from OpenAI API&gt;\nOCO_OPENAI_BASE_PATH=&lt;may be used to set proxy path to OpenAI api&gt;\nOCO_DESCRIPTION=&lt;postface a message with ~3 sentences description of the changes&gt;\nOCO_EMOJI=&lt;boolean, add GitMoji&gt;\nOCO_MODEL=&lt;either 'gpt-4', 'gpt-3.5-turbo-16k' (default), 'gpt-3.5-turbo-0613' or 'gpt-3.5-turbo'&gt;\nOCO_LANGUAGE=&lt;locale, scroll to the bottom to see options&gt;\nOCO_MESSAGE_TEMPLATE_PLACEHOLDER=&lt;message template placeholder, default: '$msg'&gt;\nOCO_PROMPT_MODULE=&lt;either conventional-commit or @commitlint, default: conventional-commit&gt;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Global Config for All Repos<\/strong><\/p>\n\n\n\n<p>Set global configurations for OpenCommit, such as the default model and language. But local configurations still take priority, allowing flexibility for specific repository needs.<\/p>\n\n\n\n<p><code>oco config set OCO_MODEL=gpt-4<\/code><\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/di-sukharev\/opencommit\" data-type=\"URL\" data-id=\"https:\/\/github.com\/di-sukharev\/opencommit\">OpenCommit<\/a> is a game-changer in the world of version control. By automating the process of crafting meaningful commit messages, it not only saves time for developers but also contributes to the overall readability and understanding of code repositories. Embrace the power of AI with OpenCommit, and say goodbye to mundane commit messages.<\/p>\n\n\n\n<p>Hope you enjoy that.<\/p>\n\n\n\n<p>Asahi<\/p>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13571\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/www.gigas-jp.com\/appnews\/archives\/13571\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"Revolutionizing Commit Messages with AI\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13571\" data-text=\"Revolutionizing Commit Messages with AI\" data-via=\"GIGASJAPAN_APPS\" data-lang=\"ja\">Tweet<\/a><\/div>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13571\" layout=\"button_count\" action=\"like\" width=\"100\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_facebook_send\"><div id=\"fb-root\"><\/div><fb:send href=\"https:\/\/www.gigas-jp.com\/appnews\/archives\/13571\" colorscheme=\"light\" ><\/fb:send><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>In the world of software development, commit messages play a crucial role in tracking changes, understanding t [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[96],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13571"}],"collection":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/comments?post=13571"}],"version-history":[{"count":2,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13571\/revisions"}],"predecessor-version":[{"id":13574,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/posts\/13571\/revisions\/13574"}],"wp:attachment":[{"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/media?parent=13571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/categories?post=13571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gigas-jp.com\/appnews\/wp-json\/wp\/v2\/tags?post=13571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}