A detached HEAD ਉਦੋਂ ਹੁੰਦਾ ਹੈ ਜਦੋਂ HEAD ਕਿਸੇ ਖਾਸ commit ਵੱਲ ਸਿੱਧਾ ਇਸ਼ਾਰਾ ਕਰਦਾ ਹੈ ਬਜਾਏ ਇਸ ਤੋਂ ਕਿ branch ਵੱਲ ਇਸ਼ਾਰਾ ਕਰੇ। ਇਹ ਇੱਕ ਆਮ ਅਵਸਥਾ ਹੈ (ਇਹ ਕੋਈ ਤਰੁੱਟੀ ਨਹੀਂ ਹੈ) ਜੋ ਵਾਪਰਦੀ ਹੈ ਜਦੋਂ ਤੁਸੀਂ ਕਿਸੇ ਖਾਸ commit, tag, ਜਾਂ remote commit ਨੂੰ check out ਕਰਦੇ ਹੋ — ਪਰ ਇਸ ਵਿੱਚ commit ਕਰਨਾ ਕੰਮ ਗੁਆਉਣ ਦਾ ਖਤਰਾ ਹੈ, ਇਸ ਲਈ ਇਸਨੂੰ ਸਮਝਣਾ ਮਹੱਤਵਪੂਰਨ ਹੈ।
HEAD ਆਮ ਤੌਰ 'ਤੇ ਕਦੋਂ ਇਸ਼ਾਰਾ ਕਰਦਾ ਹੈ
NORMALLY: HEAD → a BRANCH (e.g. main) → a commit
→ when you commit, the branch pointer advances, and HEAD follows it
DETACHED: HEAD → directly to a COMMIT (not through a branch)
→ you're "not on any branch" — looking at a specific commit
