Tôi có cùng một câu hỏi như hỏi ở đây: New git repository in root directory to subsume an exist repository in a sub-directoryXóa refs/original/heads/master khỏi git repo sau khi lọc-branch --tree-filter?
Tôi đi theo câu trả lời này ở đây: New git repository in root directory to subsume an exist repository in a sub-directory
Bây giờ, gitk --all
cho thấy hai lịch sử: một đỉnh cao trong hiện tại master
, và một trong những tên original/refs/heads/master
.
Tôi không biết lịch sử thứ hai này là gì hoặc cách xóa lịch sử thứ hai khỏi repo. Tôi không cần hai lịch sử trong kho lưu trữ của mình.
Làm cách nào để loại bỏ nó?
Để tái tạo bản thân:
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'
Bây giờ chúng ta có vấn đề poster gốc. Hãy di chuyển thư mục gốc của repo git để dự án gốc bằng cách sử dụng câu trả lời liên kết ở trên:
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
Bây giờ, nhìn thấy vấn đề hiện tại của tôi:
gitk --all &
git show-ref
Làm thế nào để thoát khỏi refs/original/heads/master
và tất cả lịch sử liên quan ?
thể trùng lặp của [Làm thế nào để xóa lịch sử cũ sau khi chạy lọc git -branch?] (http://stackoverflow.com/questions/5984428/how-to-delete-the-old-history-after-running-git-filter-branch) – user