【发布时间】:2012-05-05 07:09:42
【问题描述】:
我知道如何手动编辑旧提交:
$ 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
这里的问题:
git rebase --interactive 会启动一个编辑器,这对脚本编写来说有点糟糕。有没有办法克服这个问题,即直接将edit 0fbc8ed 传递给git rebase 命令?
我的尝试是愚蠢的,还是有更清晰的替代方法?
有一个类似的问题,但就我而言,我想将pick 更改为edit:
How can I automatically accept what git rebase --interactive presents to me?
【问题讨论】: