git
Detached HEAD state
You are in 'detached HEAD' state
Fixes
- 1.Create a branch to keep your work: `git checkout -b my-branch`
- 2.Return to a branch: `git checkout main` (commits in detached HEAD may be lost without a branch)
- 3.If you already made commits, note the SHA and cherry-pick onto a branch: `git cherry-pick <sha>`
headbranchescheckout
Related Errors
git3 fixes
Merge conflict
CONFLICT \(content\): Merge conflict in (.+)
- •Open conflicted files, resolve the <<<<<<< / ======= / >>>>>>> markers, then `git add` and `git commit`
- •Use a merge tool: `git mergetool` (configure with `git config merge.tool <tool>`)
git3 fixes
Push rejected — remote has new commits
\! \[rejected\].*\(fetch first\)|failed to push some refs.*Updates were rejected
- •Pull and rebase: `git pull --rebase origin <branch>` then push again
- •Pull and merge: `git pull origin <branch>` then resolve conflicts and push
git3 fixes
Rebase conflict
CONFLICT.*could not apply|error: could not apply
- •Resolve conflicts in the listed files, then `git add .` and `git rebase --continue`
- •Skip the problematic commit: `git rebase --skip` (loses that commit's changes)