I need to automate a interactive rebase or replace it by other commands. Just let me explain my current situation:
In an svn->git transition i need to rebase the new
expect might help you, too. Though this isn't quite what you need to do, you should be able to use something similar to automate your process:
#!/usr/bin/env expect
spawn git rebase -i HEAD~2
# change the second "pick" to "squash"
# jump to top (if not there), down, delete word, insert 's' (for squash), Escape, save and quit
send "ggjdwis \033:wq\r"
expect "# This is a"
# skip past first commit message (assumed to be one line), delete rest of file
# down 4, delete 3 lines, save and quit
send "4j3d:wq\r"
interact