0
Completed

Allow iterative rebase to select commits (contents) for edition

Bugged 5 years ago updated by Marc Strapetz 8 months ago 5

Currently, I have to go to the command line and do `git rebase -i HEAD~3`, then this appears:

pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
pick a5f4a0d added cat-file

# Rebase 710f0f8..a5f4a0d onto 710f0f8
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

So, if I would like to edit some commit contents, I would change it to:

pick f7f3f6d changed my name a bit
pick 310154e updated README formatting and added blame
edit a5f4a0d added cat-file

Then, git would use commit, but stop for amending. Allowing me to freely edit the git history, amending changes the the picked commit, or adding new commits after it. Once I am done with it, I can do `git rebase --continue` and git would rewrite the history with the new updates.

The current SmartGit interface for Iterative Rebase only allows-me to edit the commit message, it cannot edit like `use commit, but stop for amending`.

Image 254

GOOD, I'M SATISFIED
Satisfaction mark by Bugged 5 years ago
+2

For that purpose we use a separate dedicated command: "Modify or Split Commit".

+1

Wow, I missed this feature for so long and it was always there right in front of my nose.


I was not expecting this feature to be outside the cited rebase interface. I think it can help others if the `Iterative Rebase` dialog had a link to the `Modify or Split Commit`, or at lease a hint saying the `use commit, but stop for amending` feature is accessible from somewhere else, because traditional command line git users are used to access it from the `Iteractive Rebase` interface.

Anyways, thanks for making SmartGit so useful.

Excellent! I needed this to inject a commit in past history, following the answer at https://stackoverflow.com/a/32315197/3256073

It seems it's just called Modify... now.

Right-click on commit:

Image 788

You may find our videos series on "How to Clean Up Your History" interesting, especially:

;t=65s