-   Notifications  You must be signed in to change notification settings 
- Fork 290
Open
Labels
suggestionWe are still considering whether it is necessary to add this featureWe are still considering whether it is necessary to add this feature
Description
The context:
- As you know, when committing a fix for the latest commit, you can run git commit --amendto directly modify that commit
- Committing a fix for an older commit can also be done, but in two steps - Passing --fixup XXXto thegit commitcommand (where XXX is the commit's hash) creates the commit, gives it a fixup name, and marks it as a fixup commit for XXX
- Passing --autosquashtogit rebase -iautomatically moves fixup commits after the relevant commits (if they're listed), an puts the "fixup" keyword in front of them instead of the default "pick"
 
- Passing 
The issue:
- sourcegitdoes not support those options
- More generally, it does not try to make it easy for the user to handle fixup commits (beyond the existence of an interactive-rebase window)
Possible solutions:
- The most direct approach would be to separately implement both options: - When right-clicking on a commit, add an option Commit staged changes as a fixup to here
- In the interactive-rebase window, add at the top a button Toggle autosquash(maybe with a warning that it cancels and replaces the current interactive rebase if someone had started to edit it)
 
- When right-clicking on a commit, add an option 
- A more integrated approach would be to allow the user to get the same result without exposing the underlying git commands - When right-clicking on a commit, add an option Try to integrate the staged changes as a fixup to here (using rebase)- Which runs git commit --fixup XXX(because it creates a commit with a proper name)
- Then runs git rebase -ion the commit's parent (without autosquash to avoid side-effect)
- Then sets the fixup commit after XXX with the "fixup" keyword in front of it
- Then triggers the rebase as if the user has done all that manually (i.e. let them handle conflicts as usual)
 
- Which runs 
- If you choose that solution, you can reuse the logic to implement an additional feature : when right-clicking on a commit with other commits selected , add an option Try to squash the selected commits to here (using rebase)- Which runs git rebase -ion the commit's parent
- Then sets the selected commits after it with the "squash" keyword in front of them
- Then triggers the rebase as if the user has done all that manually (i.e. let them handle conflicts as usual)
 
- Which runs 
 
- When right-clicking on a commit, add an option 
goran-w, alesp, mithom, heksesang, splitt3r and 1 more
Metadata
Metadata
Assignees
Labels
suggestionWe are still considering whether it is necessary to add this featureWe are still considering whether it is necessary to add this feature