沉冰浮水

沉冰浮水

做最终到的事,成为最终成为的人!
github
bilibili
mastodon
zhihu
douban

"Git Notes" Resolving the HEAD Detached from xxxx Issue

It's been a while since I wanted to write a slightly more complex Z-BlogPHP plugin. In the process, I needed to refer to some of my other projects and made some formatting and layout changes to the plugin. I also added a new method or something like that. However, an error occurred when I tried to commit it with git - -

Key error/status information:

(HEAD detached from xxxx)

You are not currently on a branch.

git pull
# You are not currently on a branch.
# Please specify which branch you want to merge with.
# See git-pull(1) for details.

#     git pull <remote> <branch>

git bra
# * (HEAD detached from 3bff3f0)
#   master
#   remotes/origin/HEAD -> origin/master
#   remotes/origin/master

git rev

# origin  [email protected]:wdssmq/kumo-for-zblog.git (fetch)
# origin  [email protected]:wdssmq/kumo-for-zblog.git (push)

Note:

git bra and git rev, including the following git sw | git mnc, are aliases I defined myself;

You can see the specific command instructions with git branch -h;

# Create a temporary branch from the current HEAD

git br for-fix-2211
git bra
# * (HEAD detached from 3bff3f0)
#   for-fix-2211
#   master
#   remotes/origin/HEAD -> origin/master
#   remotes/origin/master

# It seems like nothing can be seen, let's add the -v parameter to take a look

git bra -v
# * (HEAD detached from 3bff3f0) ec3bf35 base. git configuration
#   for-fix-2211                 ec3bf35 base. git configuration
#   master                       3bff3f0 Prompt message when the rule is empty;
#   remotes/origin/HEAD          -> origin/master
#   remotes/origin/master        3bff3f0 Prompt message when the rule is empty;

# Switch to the master branch

git sw master
git bra -v
#   for-fix-2211          ec3bf35 base. git configuration
# * master                3bff3f0 Prompt message when the rule is empty;
#   remotes/origin/HEAD   -> origin/master
#   remotes/origin/master 3bff3f0 Prompt message when the rule is empty;

# Merge the branches

git mnc for-fix-2211
git bra -v
#   for-fix-2211          ec3bf35 base. git configuration
# * master                ec3bf35 [ahead 3] base. git configuration
#   remotes/origin/HEAD   -> origin/master
#   remotes/origin/master 3bff3f0 Prompt message when the rule is empty;

# Delete the temporary branch and then push

git br -d for-fix-2211
git push

Git - git-branch Documentation:

https://git-scm.com/docs/git-branch#

"Troubleshooting" - Quick Input of git and docker Commands_Computer Networking_沉冰浮水:

[https://www.wdssmq.com/post/20171130103.html](https://www.wdssmq.com/post/20171130103.html "Troubleshooting" - Quick Input of git and docker Commands_Computer Networking_沉冰浮水 ")

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.