Open NightMachinery opened 3 months ago
Thanks for trying aider and filing this issue.
I've been thinking about this lately and laying some groundwork for a squash feature.
In the meantime you could do:
/git reset --soft HEAD~3
/commit
This will squash the last 3 commits with an appropriate commit message.
I don't know if this is on topic or not here, but something I've been really wanting is a smart squash that uses fixup for fixes, squash where it makes sense, and generally just rewrites history to make it pretty.
Then slaps new commit messages on top.
That's what I've been thinking about. I've been making some design notes and laying groundwork.
The recent feature to do multiple /undo commands was working towards this.
An idea for the workflow would be to start with a command /new_feat
or /tdd
. Then you start implementing the feature or unit test step by step. When finished you say /done
or /finish
and it automatically merges all the commits made from the time the first command was given.
I'd like to propose an enhancement to the labeling system within the Aider AI coding assistant to improve version control workflows. This feature would introduce a flexible labeling mechanism, allowing developers to mark specific points in their development process. These labels could then be used in conjunction with various commands to manage and manipulate the Git history more effectively.
Command #5 suggested below is the squash command. Should I make this it's own post? I originally just wanted to give a few more suggestions for possible names to @Roald87 's suggestion, which I liked. But then I got to thinking about it and wrote this more detailed proposal which incorporates potential for a lot more features from a similar idea. edit I did make it's own post: #1172
To ensure that labels remain consistent and accessible across sessions, the labels would be stored persistently in the .aider
meta files within the workspace. This allows labels to be saved, loaded, and referenced even after the coding assistant or workspace is restarted. This persistence ensures that developers can rely on labels to maintain continuity in their workflow, making it easier to manage and navigate the project over time.
Key Benefits:
/set \<label> [commit_id]
commit_id
is provided. This label can then be referenced by other commands..aider
meta file, ensuring it remains accessible across sessions./diff \<label>
git diff
command used, enabling easy replication in the terminal./log \<label>
/save \<label>
git stash
), labeled with the custom name./squash \<label>
/info \<label>
/search \<label>
/cost \<mylabel> [myotherlabel]
featureX
: $45.67"featureX
and featureY
: $23.45".aider
meta files within the workspace to ensure accurate cost reporting.This proposal introduces a sophisticated labeling system to efficiently track key events and manage commit history in a structured way. The system leverages automatic labels, reserved labels, and sublabels, which together provide developers with powerful tools for maintaining a clean, navigable, and organized codebase.
Automatic labels are labels that the system creates without user intervention, marking significant events in the development process. These labels are similar to the latest
tag in containers or release management, automatically updating to point to the most recent state of a specific event, such as a successful lint or test pass.
Reserved labels are a specific type of automatic label that are always active, ensuring that critical moments in the development cycle are consistently tracked, regardless of user-defined labels.
Example Reserved Labels:
linted
: Automatically updates whenever all files pass linting, marking the most recent clean code state.passed
: Automatically updates when all tests pass, indicating the latest stable build.These labels allow developers to easily revert to or squash commits back to key milestones in their codebase, ensuring stability and consistency.
Automatic and reserved labels can be applied at both the sublabel level (within a specific development phase) and the label level (across the entire project timeline).
Automatic Sublabels:
mylabel.linted
whenever all files pass linting under a specific label.mylabel.passed
each time tests pass successfully under a specific label.Usage Examples:
mylabel
label.mylabel
label.Reserved Automatic Labels:
linted
and passed
.Usage Examples:
See my other issue for how this could tie into cost tracking and aider contribution percentage tracking...
I don't know if this is on topic or not here, but something I've been really wanting is a smart squash that uses fixup for fixes, squash where it makes sense, and generally just rewrites history to make it pretty.
Then slaps new commit messages on top.
Yes! It does sound like there are two classes of feature requests here:
1/ Do something to help manage all of aiders commits
2/ Do a smart re-base/squash that is independent of aiders changes, being smart about pulling out chores vs features vs orthogonal changes.
For 2, you could even imagine an aider command like, rebase /rebase - origin/master
(and/or the labels @GeoffMillerAZ defined above), and aider could give you recommendations like: I see refactors and an independent implementation of feature foo. Splitting them is easier on reviewers, shall I proceed?
Is there an easy way to squash commits?
The AI keeps committing for each message, and this litters the history. Having
/squash 3
which automatically generates a prompt message using AI and squashes would be good.