[깃] Detached HEAD

Kyu·2021년 2월 8일
0

Git 공부기록

목록 보기
1/4
post-thumbnail

Kyu 21 minutes ago

실제 깃으로 해보니까 애초에 HEAD가 분리될때 부터 아래와 같이 안내사항이 나왔습니다.

$ git checkout fedde9d
Note: checking out 'fedde9d'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
  git checkout -b <new-branch-name>
  
HEAD is now at fedde9d 5

제가 이해하기로는 다른 커밋들과 관계없이 분리된 HEAD에서 맘대로 테스트해보다가 돌아올 수 있는,,일종의 테스트 커밋? 라고 이해했어요.. 해결된 것 같습니다? ㅎㅎ

추가적으로 HEAD가 분리된 상태에서 또 새로운 커밋하나 만들고

$ git commit

다른 브랜치로 체크아웃하니 아래와 같은 이런 안내사항이 떴어요

$ git checkout master
Warning: you are leaving 1 commit behind, not connected to
any of your branches:
  2e25932 detached HEAD TEST
If you want to keep it by creating a new branch, this may be a good time
to do so with:
 git branch <new-branch-name> 2e25932
Switched to branch 'master'

commit behind 가 무슨 말인지 정확하게 이해는 못했으나..어쨋든
터미널로 테스트해보니 제 질문은 해결된거 같습니다! ㅎㅎ 감사합니다~!
저 커밋은 나중에 GC가 된다는 것도 머리에 담아두겠습니다!

질문: 커밋이 비하인드 되었다는 게 무슨말일까?

profile
TIL 남기는 공간입니다

0개의 댓글