Git được dựa trên nội dung và không có tập tin vì vậy tôi đang hiểu các hành vi sau đây nhưng tôi muốn biết nếu có một tùy chọn đặc biệt hoặc hack để phát hiện điều như vậy:Git làm thế nào để phát hiện toàn bộ thư mục bị xóa/di chuyển
git init
mkdir -p foo/bar
echo "test" foo/a.txt
echo "test2" foo/bar/b.txt
git add -A
git commit -m "test"
rm -fr foo
git add -A
git commit -m "delete whole dir"
git log --name-status
Khi tôi kiểm tra đăng nhập, Git
sẽ không nói rõ với tôi rằng foo
đã bị xóa nhưng tất cả tập tin foo/a.txt
và foo/bar/b.txt
đã bị xóa
commit d1513a9b36cd546371a194e798566c49e779e3a9
Date: Tue Sep 8 16:58:21 2015 +0200
delete whole dir
D foo/a.txt
D foo/bar/b.txt
commit 135f7ae52dfddcee5eeb7bdfa9f0d5c924fed3af
Date: Tue Sep 8 16:58:10 2015 +0200
test
A foo/a.txt
A foo/bar/b.txt
Vì vậy, nếu tôi có thể tạo các cam kết sau:
mkdir -p foo/bar
echo "test" > foo/a.txt
echo "test2" > foo/bar/b.txt
echo "test3" > foo/bar/c.txt
git add -A
git commit -m "test2"
rm -f foo/a.txt foo/bar/b.txt
git add -A
git commit -m "delete just 2 files"
git log --name-status
name-status
giữa cam kết delete whole dir
và delete just 2 files
tương tự
commit 92564fb59464fd6bba2766a6d488c2ff8ca967ea
Date: Tue Sep 8 17:03:09 2015 +0200
delete just 2 files
D foo/a.txt
D foo/bar/b.txt
commit 3b13f27e960c4ec66464e8a1e0d23f038a872564
Date: Tue Sep 8 17:02:50 2015 +0200
test2
A foo/a.txt
A foo/bar/b.txt
A foo/bar/c.txt
Có cách nào để phát hiện sự khác biệt khi toàn bộ thư mục bị xóa?
Tôi không nghĩ rằng đó là cách để phát hiện sự khác biệt – edi9999
Không, bạn không thể làm điều đó – Bijendra