Skip to content

Interactive Rebase: Edit commit #773

@Cyrillev91

Description

@Cyrillev91

Hi,
During an interactive rebase, we use the edit keyword when we want to modify a commit.
The possible actions on this commit are:

  • add a forgotten file (git add newfile.txt)
  • modify a file (git add file.txt)
  • delete a file (git restore --staged delfile.txt)
  • modify the commit message.
    then continue the rebase.

Here with sourcegit when we launch a git rebase to edit a commit,:
image

The GUI does not allow us to see the actual content of the commit being edited (impossible to delete a file for example, not clear on the commit message of the rewritten one)

I think that for a better user experience:
We should display the commit marked with edit in the same way as when the amend button is checked in the case of the rewriting of the last commit:

  • check the Amend box to clearly identify that we are rewriting a commit (It is not possible to do it manually because the checkbox is not displayed)
  • in the stage: display the current files of the commit
  • display the comment of the edited commit
  • the commit button could be called "Ammend Commit" for clarity.
    So the user can modify the commit marked edit :
  • add a forgotten file (with the sourcegit GUI)
  • modify a file (with the sourcegit GUI)
  • delete a file (with the sourcegit GUI)
  • modify the commit message.
  • Validate the changes of this commit by pressing the "Amend Commit" button
    (possibly add a new commit as suggested in To split a commit, Resolve of Interactive Rebase (Edit) needs a Commit button (besides Continue) #767).
    Then click on the continue button to continue the rebase.
    Amend

Sample with the command line:
git rebase -i abcdef
pick commit x
edit commit y
pick commit z

git reset --soft HEAD^
git restore --staged path/to/unwanted_file (delete a file)
git add file (add/edit a file)
git commit -c ORIG_HEAD (for the same commit message)

git rebase --continue

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions