我知道如何手动编辑旧提交:
$ 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
to the git rebase
命令?
我正在尝试的事情是愚蠢的还是有更清晰的替代方法来做到这一点?
有一个类似的问题,但就我而言我想改变pick
to edit
:
我如何自动接受 git rebase --interactive 呈现给我的内容? https://stackoverflow.com/questions/3548693/how-can-i-automatically-accept-what-git-rebase-interactive-presents-to-me
这是“git filter-branch”和选项“--commit-filter”的工作。查看手册页,这里有一个示例部分。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)