问题:执行git status,提示: HEAD detached from origin/master

原因:分支选错了,后续的提交都提交到了一个匿名分支之上,整个状态是游离了的

解决方法:

1.查看在游离状态下提交的最新commit号

git branch -v

2.创建一个临时的分支,创建完成之后切换到该分支上查看一下

git branch temp 最新的commit号

eg:  git branch temp f1bb742

3.切换到要合并的分支上

git checkout 要合并临时分支的分支名称

eg: git checkout master

4.合并分支

git merge temp

5.删除临时分支

git branch -d temp

6.推送合并后的分支到远程仓库

git push origin 分支名称:远程分支名称

eg: git push origin master

转载:https://www.cnblogs.com/jimaojin/p/8949736.html

 

git status: HEAD detached from origin/master问题的解决的更多相关文章

  1. git出现Your branch and 'origin/master' have diverged解决方法

    如果不需要保留本地的修改,只要执行下面两步:git fetch origingit reset --hard origin/master 当我们在本地提交到远程仓库的时候,如果遇到上述问题,我们可以首 ...

  2. git pull 然后 ahead of origin/master * commit 消失

    本来显示 your branch is ahead origin/master * commit后来也许在master merge 这个分支后, 然后git pull, 就显示Your branch ...

  3. idea关联git后 Git上传项目提示Push rejected: Push to origin/master was rejected解决办法

    当所有的东西都配好以后  就是不上数据  解决方案是在所属右键 点击Git BashHere后  输入:git pull origin master –allow-unrelated-historie ...

  4. git 提示:fatal: remote origin already exists. 错误解决

    今天git连接远程库的时候出现fatal: remote origin already exists. 这个错误 大概是之前连接过别的库吧 然后我们的解决办法就是删除之前的连接 1.删除git远程仓库 ...

  5. git status message - Your branch is ahead of origin/master by X commits

    git reset --hard origin/master git status FAQ: When I issue the "git status" command, I se ...

  6. homebrew update 出现Failure while executing: git pull --quiet origin refs/heads/master:refs/remotes/origin/master解决方案

    具体可以参考https://github.com/Homebrew/homebrew/issues/21002 cd /usr/local git status git reset --hard or ...

  7. Git报错:Your branch is ahead of 'origin/master' by 1 commit

    .    commit之后,用git status,打印信息为: # On branch master # Your branch is ahead of 'origin/master' by 1 c ...

  8. Git代码提交报错 (Your branch is up to date with 'origin/master)

    一.前言 今天码云上提交自己本地的一个SpringBoot+Vue的小项目,由于前端代码提交第一次时候提交码云上文件夹下为空,于是自己将本地代码复制到码云拉取下来代码文件夹下,然而git add . ...

  9. [小技巧] git: Your branch and 'origin/master' have diverged

    本文参考:http://stackoverflow.com/questions/19864934/git-your-branch-and-origin-master-have-diverged-how ...

随机推荐

  1. Vector , list 和 deque的区别

     vector   表示一段连续的内存区域,每个元素被顺序存储在这段内存中,对vector   的随机访问效率很高,但对非末尾元素的插入和删除则效率非常低.  deque    也表示一段连续的内存区 ...

  2. h5学习之表单

    <html> <head> <title>新型input类型及表单新元素</title> <meta charset="utf-8&qu ...

  3. for循环中的闭包

    // 问题1:判断下面一段代码运行的结果是什么? var data = [] for (var i = 0; i < 3; i++) { data[i] = function() { conso ...

  4. redis----Not only Sql 理论

    数据存储的瓶颈:(mysql ==>500万数据就已经很慢了) 1 数据量的总大小,一个机器放不下时 2 数据 的索引,一个机器的内存放不下时 3 访问量(读写混合),一个实例不能承受 Redi ...

  5. db2 with用法

    最近在研究db2 递归查询时想到了with,一直以为with只是用来查询递归,但是实际with功能强大,还有更加强大的功能,偶然读到一位大神的文章,对with做了很详细的解读,特贴出来供大家学习研究 ...

  6. 配置linux ftp服务器,客户端报list remote folder fail

    XFTP出现列表文件夹失败.主要是因为FTP模式不对,应该为主动连接模式, 可以在设置主机属性 - 选项页签 - 将默认勾选的“使用被动模式”(使用消极模式)的多选框取消...就可以了...

  7. github仓库管理项目

    一,建立本地git仓库 首先,git要求使用者必须提供自己的身份标识,为此我们需要在git bash中执行以下命令: git config --global user.name  'aa.Tessst ...

  8. inferiors

    inferiors 英[ɪnˈfɪərɪəz] 美[ɪnˈfɪriərz] n. 不如别人的人; 级别(或地位)低的人; [词典] inferior的复数; info inferiors

  9. Java web中文乱码

    1.设置工程的编码方式 window-preferences-general-workspace 改成uef-8 2.设置html的编码方式 <meta http-equiv="Con ...

  10. oracle ORA-16038 ORA-00257

    出现 ORA-16038时也可以参考下边的错误,好像有关联影响 出现ORA-00257错误(空间不足错误),通过查找资料,绝大部分说这是由于归档日志太多,占用了全部的硬盘剩余空间导致的,通过简单删除日 ...