내가 작은 커밋의 몇 가지를 가지고 REPO가 제거되지 커밋. 이 상태에 나는 실행 $ git reset initial
는 지금 참조하십시오는 자식 리셋 후, 도달 할 수없는이
* e6e6a8b (master) hello world now
* f308f53 Made it echo
* f705657 Added hello
* 08a2de3 (HEAD -> testbranch, tag: initial) initial
내가 기대 한 것 :이 도달 할 수없는 때문에 a0fc4f8 삭제 될 커밋합니다. 무슨 일
: git show a0fc4f8
을하는
1) 여전히이
2) git status
을하는 커밋 표시에 의해 추가 된 file.txt
이 같은 추적되지 a0fc4f8 커밋하고 또한 비 추적 나타 안녕하세요이이 f705657 커밋에서 추가 된 파일을 보여줍니다.
3) git gc
또는 git gc --prune=all
을 실행해도 a0fc4f8은 더 이상 도달 할 수 없으며 해당 이름/태그가 연관되어 있지 않지만 삭제되지 않습니다.
왜 이런 일이 발생합니까?
업데이트 : 2
$ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (15/15), done.
업데이트 : 커밋
$ git log --all --decorate --graph --oneline
* e6e6a8b (master) hello world now
* f308f53 Made it echo
* f705657 Added hello
* 08a2de3 (HEAD -> testbranch, tag: initial) initial
$ git gc --force
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (15/15), done.
Total 15 (delta 1), reused 15 (delta 1)
$ git log --all --decorate --graph --oneline
* e6e6a8b (master) hello world now
* f308f53 Made it echo
* f705657 Added hello
* 08a2de3 (HEAD -> testbranch, tag: initial) initial
$의 자식 쇼 a0fc4f8 아직도 보여줍니다
업데이트 3 :
을하는$ git reflog testbranch
08a2de3 [email protected]{0}: reset: moving to initial
a0fc4f8 [email protected]{1}: commit: added file.txt
e6e6a8b [email protected]{2}: branch: Created from HEAD
'git gc --prune = all' 다음에'git fsck'는 무엇을 말합니까? –
@ MichałWalenciak : 업데이트를 확인하십시오. – Jim
'git reset (--mixed) initial'을 실행하면 작업 디렉토리가 변경되지 않습니다. 이것이 변경 사항이 모두 a0fc4f8 커밋에있는 이유입니다. – C1sc0