我必须重写我的存储库的历史记录,因为它包含一些凭证。因为我有修改根犯我跟着从Git Faq说明:Git,编辑所有分支的根提交
git rebase -i
可以让你方便地编辑任何以前提交,除了根提交。以下命令显示如何手动执行此操作。# tag the old root git tag root `git rev-list HEAD | tail -1` git checkout -b new-root root # edit... git commit --amend # check out the previous branch git checkout @{-1} # replace old root with amended version git rebase --onto new-root root # cleanup git branch -d new-root git tag -d root
我的问题是,虽然我在仓库中有两个分支,几个标签已经和我想的是我的历史改写适用于这些了。回购尚未公开,所以这不成问题。我之前询问过similar question,但在这种情况下,没有使用git rebase
命令。这里是我的回购协议的基本图形:
+ master branch
|
| + topic branch
| |
| |
+---+
|
|
|
+ TAG
|
+ Initial commit, the commit I'd like to amend for all branches
它甚至有可能?
可能相关:[编辑/修改/修改/更改Git中的第一个/根/初始提交?](http://stackoverflow.com/q/2119480/456814)。 – 2014-05-15 08:47:24