Detached HEAD - CI/CD用語集の定義
detached HEAD の状態とは、HEAD が branch ではなく commit を直接指している状態で、新しい commit はどの branch にも属さず、別の場所へ切り替えると失われる可能性があります。これは git checkout <sha> の後や tag を checkout したときに起こります。
detached HEAD の状態とは、HEAD が branch ではなく commit を直接指している状態で、新しい commit はどの branch にも属さず、別の場所へ切り替えると失われる可能性があります。これは git checkout <sha> の後や tag を checkout したときに起こります。
detached HEAD の状態とは、HEAD が branch ではなく commit を直接指している状態で、新しい commit はどの branch にも属さず、別の場所へ切り替えると失われる可能性があります。これは git checkout <sha> の後や tag を checkout したときに起こります。
CI での扱い
ほとんどの CI の checkout は detached HEAD 状態で実行され、HEAD を実行のきっかけとなった正確な commit に向けます。これは想定どおりの動作です。branch 上で作業するには git checkout -b <name> または git switch -c <name> を実行します。
関連ガイド
HEAD - CI/CD Glossary DefinitionHEAD: HEAD is the symbolic ref pointing to the current branch (or, when detached, directly to a commit). It m…
Reflog - CI/CD Glossary DefinitionReflog: The reflog records every update to `HEAD` and branch tips locally, so `git reflog` can recover commit…
Git Ref - CI/CD Glossary DefinitionGit Ref: A git ref is a named pointer to a commit, stored under `.git/refs/` (or in `packed-refs`). Branches,…