Solution to the problem of git HEAD detached from origin

This problem is because the wrong branch is selected, so the subsequent submissions are submitted to an anonymous branch, and the entire state is free

Here are the steps I took to solve the problem

1. Check the latest commit number submitted in the free state

git branch -v

2. Create a temporary branch, switch to the branch after the creation is complete and check it out

git branch temp latest commit number

3. Switch to the branch IQ you want to merge

git checkout the name of the branch to merge the temporary branch with

4. Merge branches

git merge temp

5. Delete the temporary branch

git branch -d temp

6. Push the merged branch to the remote repository

git push origin branch name: remote branch name

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324862539&siteId=291194637