我有一个带有master
分支的 git 存储库,我想在其中创建一个empty
包含分支的第一次提交的master
分支,具有相同的哈希(最后一点非常重要)。我尝试了挑选,但这并没有给出具有相同哈希的提交:
$ git log # we are on master
commit bfe76c82dace725e84e09dfa472b4ccef91495c6
Author: Name <email>
Date: Wed Apr 10 15:40:45 2013 +0200
Made some changes to README
commit 8b4c9dbcb4c5c0f966780f8b2f7ba356e3480fca
Author: Name <email>
Date: Wed Apr 10 15:39:35 2013 +0200
Added README
$ git checkout --orphan empty
Switched to a new branch 'empty'
$ git rm --cached *
rm 'README.rst'
$ git clean -fxd
Removing README.rst
$ git log
fatal: bad default revision 'HEAD'
$ git cherry-pick 8b4c9dbcb4c5c0f966780f8b2f7ba356e3480fca
[empty (root-commit) 1556211] Added README
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.rst
$ git log
commit 1556211343e404861ba9f7ec627b6d6f216217e0
Author: Name <email>
Date: Wed Apr 10 15:39:35 2013 +0200
Added README
如您所见,第一次提交的哈希是不同的。实现我想要做的最简单的方法是什么?