di-sukharev / di-sukharev/opencommit

[Feature]: Break into smaller commits

Open
#114 10 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
7.5k
Forks
445
Avg merge
18m
Merged PRs (30d)
2

Description

Description

Right now, oc generates one commit with a message relevant to one change/file, and the git description will mention multiple files with different changes.

For example, here is a git description that was generated:

└  Commit message:
——————————————————
🐛 fix(chatgpt-view-provider.ts): move webpackScript script tag below the root div
🐛 fix(chat.tsx): add optional chaining to marked.setOptions() call
🎨 style(main.css): add text color to [role="tooltip"] element
The script tag for webpackScript was moved below the root div to ensure that the root div is loaded before the script. The optional chaining operator was added to the marked.setOptions() call to prevent errors when the marked library is not loaded. The text color was added to the [role="tooltip"] element to improve readability.
Suggested Solution

One option is to break each file into its own separate commits. Not really the ideal way to use git and would need some hard-limits on how many commits it will make at once, but the commit messages would be more useful, and it seems relatively straight-forward if GPT's response is consistent.

Alternatives

Another, more advanced option is to have GPT step through git add --patch. It would take some tweaking, but it would allow GPT to intelligently break up changes into separate commits if a file has changes that would logically be separated into different commits.

Additional Context

This would make sense as an option in the CLI, so by default it would be off. Users using git properly wouldn't be running commit for multiple, different code changes. But, since this doesn't always happen in practice, this is a great opportunity for GPT ai to do the tedious work of grouping similar changes into separate commits.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the CLI flow that creates a commit and review how generated changes and commit messages are currently grouped. Compare the separate-file approach with the proposed git add --patch alternative, then define the CLI option, default-off behavior, and hard limit before implementing. Done means related changes can be split into separate commits without forcing the option on users.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, javascript
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.