我在这里提出了同样的问题:New git repository in root directory to subsume an existing repository in a sub-directory
我在这里遵循了这个答案:New git repository in root directory to subsume an existing repository in a sub-directory
现在,gitk --all
显示了两个历史:一个在 currentmaster
中达到高潮,另一个在original/refs/heads/master
.
我不知道这第二个历史是什么,或者如何从回购中删除它。我的存储库中不需要两个历史记录。
我该如何摆脱它?
要复制自己:
mkdir -p project-root/path/to/module
cd project-root/path/to/module
mkdir dir1 dir2 dir3
for dir in * ; do touch $dir/source-file-$dir.py ; done
git init
git add .
git commit -m 'Initial commit'
现在我们遇到了原始海报的问题。让我们使用上面链接的答案将 git repo 的根目录移动到 project-root :
git filter-branch --tree-filter 'mkdir -p path/to/module ; git mv dir1 dir2 dir3 path/to/module' HEAD
rm -rf path
cd ../../../ # Now PWD is project-root
mv path/to/module/.git .
git reset --hard
现在,看看我目前的问题:
gitk --all &
git show-ref
我如何摆脱refs/original/heads/master
所有相关的历史记录?