You are not currently on a branch

An error was reported when git push submitted the code today

You are not currently on a branch, so I cannot use any
'branch.<branchname>.merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

This error means that you are not on the branch and cannot commit.
You need to create a temporary branch, based on this temporary branch, merge your code into the master branch. Just delete this temporary branch after merging.

  1. First use the git branch command to view the location
 git branch
 1. (HEAD detached from bdcfe3a8)
 2. master
 3. issue699

The current position is: HEAD detached from bdcfe3a8
2. Create a temporary branch and merge the code into master

git branch temp bdcfe3a8     #   依据快照bdcfe3a8  创建 temp 分支
git checkout master          #   切换到 master 分支
git merge temp               #   将 temp 分支合并到 master分支

At this time, the code has been integrated into the master, and the temporary branch temp can be deleted

git branch -d temp

Guess you like

Origin blog.csdn.net/weixin_42648692/article/details/129038917