Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Break into smaller commits #114

Open
Christopher-Hayes opened this issue Apr 3, 2023 · 10 comments
Open

[Feature]: Break into smaller commits #114

Christopher-Hayes opened this issue Apr 3, 2023 · 10 comments

Comments

@Christopher-Hayes
Copy link

Christopher-Hayes commented Apr 3, 2023

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.

@weeryan17
Copy link

I agree it's not the best currently for a lot of changes, although in my case I'm running into where all the stuff I work on is related to one feature/item, but I have a lot of changes to that feature/item, so another option could be (if possible) have it try to identify the feature (or features), and split it up by that, make a summary of the feature, and then add the individual changes in the lines bellow. I don't know if that's possible, but I think that would honestly work the best.

If that's not possible, maybe an option to generate a message for you (but not commit) to copy paste and then you can write the summary yourself. I know you can go in an amend the commit, but might be easier to not have to.

@di-sukharev
Copy link
Owner

you could just stash and oc feature files separately, no?

@weeryan17
Copy link

weeryan17 commented Apr 5, 2023

You can, however like mentioned it doesn't generate a summary of all changes, so you'd have to go in and amend the commit message every time, not to mention I noticed default behavior is to push the committed code so if you accidentally select yes to that then you'd have more problems. That's why at the very least it would be nice if their was an option to output it's generated messages instead of immediately committing them so a person could write a summary easily.

@Christopher-Hayes
Copy link
Author

Yeah this can all be done manually, the idea is developers are lazy and ai could potentially automate the tedious part of separating files/code into individual commits.

@kamushadenes
Copy link

kamushadenes commented Apr 6, 2023

I came looking exactly for that, my projects usually require lots of changes for a single feature and the commit message ends up being huge, plus things like goreleaser get confused when generating release notes for such large (and mixed-content) commit messages.

For example, check this automatically generated release notes, it's quite a mess: https://github.com/kamushadenes/chloe/releases/tag/v0.6

@Christopher-Hayes
Copy link
Author

Christopher-Hayes commented Apr 6, 2023

@kamushadenes that's a cool project. Looks further along than the other "AGI" task-based projects I've seen on GitHub. (Sorry getting off topic)

@kamushadenes
Copy link

@Christopher-Hayes thanks! This has been my pet project for a couple weeks now. I would love to hear some feedback and ideas if you have ;)

Regarding the release notes, I ended up doing this: https://github.com/kamushadenes/chloe/blob/main/.github/scripts/release-notes.py

Not perfect, but seems to handle well this specific case.

For example, it went from this:

image

To this:

image

@github-actions
Copy link

Stale issue message

@dasheck0
Copy link

Is this issue resolved? TBH this is the only issue preventing me from using this regularly. I tried some of the work arounds (commit one by one, using the action, trying to resolve this in the changelog). None of them are clean enough for me to work :D So just wondering what your thoughts on this are.

@Christopher-Hayes
Copy link
Author

Is this issue resolved? TBH this is the only issue preventing me from using this regularly. I tried some of the work arounds (commit one by one, using the action, trying to resolve this in the changelog). None of them are clean enough for me to work :D So just wondering what your thoughts on this are.

I think the current status of this is "Help Wanted". I'd love to try implementing this, just haven't had the time to dig in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants