I know how to edit an old commit manually:
$ git log --pretty=format:'%h %s'
60e5ed9 Second commit
0fbc8ed First commit
$ git rebase --interactive 0fbc8ed # Going back to 'First commit'
# * $EDITOR gets fired up *
# change 'pick 0fbc8ed' to 'edit 0fbc8ed'
$ echo 'Hello Kitteh!' > some_file
$ git add some_file
$ git commit --amend -m 'some message'
$ git rebase --continue # Go back
The problem here:
git rebase --interactive
fires up an editor, which is kinda bad for scripting purpose. Is there any way to overcome this, i.e. directly passing edit 0fbc8ed
to the git rebase
command?
Is it idiotic what I'm attempting or is there maybe a clearer, alternative way to do this?
There is a similar question, but in my case I want to change pick
to edit
:
How can I automatically accept what git rebase --interactive presents to me?