@@ -17,7 +17,7 @@ This project is a Rust implementation of the Go based git-cmd project found [her
1717- 🤖 ** AI-powered** : Uses OpenAI models (default: ` gpt-4.1-mini ` ) to analyze code changes
1818- 📝 ** Conventional Commits** : Generates messages in the ` type(scope): description ` format
1919- 🎯 ** Smart Analysis** : Understands code changes and suggests contextually appropriate messages
20- - ✅ ** User Confirmation** : Asks for y/n confirmation before committing
20+ - ✅ ** Push Confirmation** : Asks for y/n confirmation before pushing to remote
2121- ⚡ ** Interactive** : Opens your editor for final review and editing before committing
2222- 📦 ** Auto-staging** : Automatically stages all changes with ` git add . ` before analysis
2323- 🔍 ** Diff-aware** : Analyzes changes to generate contextually appropriate messages
@@ -70,9 +70,10 @@ sudo mv target/release/git-cmt-rs /usr/local/bin/git-cmt-rs
7070 ``` bash
7171 git-cmt-rs
7272 ```
73- 2 . Review the generated commit message and confirm (y/n).
74- 3 . If confirmed, the editor opens for final review and editing.
75- 4 . Save and close the editor to complete the commit.
73+ 2 . The editor opens for final review and editing of the commit message.
74+ 3 . Save and close the editor to create the commit.
75+ 4 . After commit, confirm whether to push to remote (y/n).
76+ 5 . If confirmed, changes are pushed; if declined, commit stays local.
7677
7778The tool automatically stages all changes with ` git add . ` before analyzing and generating a commit message.
7879
@@ -82,9 +83,10 @@ The tool automatically stages all changes with `git add .` before analyzing and
82832 . ** Diff Analysis** : Reads staged changes with ` git diff --cached -b ` (truncated to 3072 chars if necessary)
83843 . ** AI Processing** : Sends the diff to OpenAI with structured prompts and JSON schema enforcement
84854 . ** Message Generation** : Produces a commit object with ` type ` , ` scope ` , and ` message `
85- 5 . ** User Confirmation** : Displays the generated message and asks for confirmation (y/n)
86- 6 . ** Interactive Commit** : Opens your editor with the message for final review and editing (if confirmed)
87- 7 . ** Final Commit** : Runs ` git commit ` with the approved message
86+ 5 . ** Interactive Commit** : Opens your editor with the message for final review and editing
87+ 6 . ** Create Commit** : Runs ` git commit ` with the approved message
88+ 7 . ** Push Confirmation** : Asks user to confirm push to remote (y/n)
89+ 8 . ** Final Push** : Runs ` git push ` if confirmed, or exits with commit saved locally if declined
8890
8991## Commit Message Format
9092
@@ -98,47 +100,49 @@ type(scope): description
98100
99101## Examples
100102
101- ### Feature Addition
103+ ### Feature Addition (Push Confirmed)
102104
103105``` bash
104106$ git-cmt-rs
105107Staged all changes with ` git add .`
106108Staged diff found; generating message for changes...
107109Parsed commit: type=' feat' , scope=' auth' , message=' add OAuth2 login integration'
108110
109- Generated commit message:
110- feat(auth): add OAuth2 login integration
111-
112- Proceed with commit? (y/n): y
113111# Opens editor for final review
114- # Save and close to complete the commit
112+ # Save and close editor to commit
113+
114+ Commit created successfully.
115+ Push commit to remote? (y/n): y
116+ Changes pushed successfully!
115117```
116118
117- ### Bug Fix
119+ ### Bug Fix (Push Declined)
118120
119121``` bash
120122$ git-cmt-rs
121123Staged all changes with ` git add .`
122124Staged diff found; generating message for changes...
123125Parsed commit: type=' fix' , scope=' api' , message=' resolve null pointer in validation'
124126
125- Generated commit message:
126- fix(api): resolve null pointer in validation
127+ # Opens editor for final review
128+ # Save and close editor to commit
127129
128- Proceed with commit? (y/n): n
129- Commit cancelled.
130+ Commit created successfully.
131+ Push commit to remote? (y/n): n
132+ Push cancelled. Commit saved locally.
130133```
131134
132- ### Declining the Commit
135+ ### Keeping Commit Local
133136
134- Users can respond with ` n ` or ` no ` to cancel the commit without opening the editor :
137+ Users can respond with ` n ` or ` no ` at the push confirmation to keep the commit local without pushing to remote :
135138
136139``` bash
137140$ git-cmt-rs
138141Staged all changes with ` git add .`
139142...
140- Proceed with commit? (y/n): n
141- Commit cancelled.
143+ Commit created successfully.
144+ Push commit to remote? (y/n): n
145+ Push cancelled. Commit saved locally.
142146```
143147
144148## Configuration
@@ -157,8 +161,10 @@ Commit cancelled.
157161- ** Missing API key** → exits with message to set ` OPENAI_API_KEY `
158162- ** API failures** → shows HTTP status and response body
159163- ** Invalid JSON** → shows raw model output for debugging
160- - ** User cancellation** → exits gracefully with "Commit cancelled." when user responds with ` n ` or ` no `
161- - ** Invalid confirmation input** → prompts user to answer ` y/n ` again
164+ - ** Commit creation failed** → exits with error message if ` git commit ` fails
165+ - ** Push declined** → exits gracefully with "Push cancelled. Commit saved locally." when user responds with ` n ` or ` no `
166+ - ** Push failed** → shows error if ` git push ` fails (commit is already saved locally)
167+ - ** Invalid push confirmation input** → prompts user to answer ` y/n ` again
162168
163169## Development
164170
@@ -212,7 +218,14 @@ This project is open source. See the repository for details.
212218 export EDITOR=" code --wait"
213219 ```
214220
215- ** "Commit cancelled" message**
221+ ** "Push cancelled. Commit saved locally." message**
222+
223+ - This is expected behavior. The user can respond ` n ` or ` no ` at the push confirmation prompt to keep the commit local.
224+ - The commit is already created and saved; the push is simply skipped.
225+ - You can push manually later with ` git push ` .
226+
227+ ** "Push failed" error**
216228
217- - This is expected behavior. The user can respond ` n ` or ` no ` at the confirmation prompt to cancel the commit without opening the editor.
218- - The tool exits gracefully without making any changes to the repository.
229+ - The commit was created successfully, but the push to remote failed (network issues, authentication, etc.)
230+ - Your commit is safely saved locally
231+ - You can try pushing again manually or resolve any issues before retrying
0 commit comments