美文网首页
使用 git 错误 You are not currently

使用 git 错误 You are not currently

作者: 游城十代2dai | 来源:发表于2018-12-05 18:01 被阅读23次

场景


本身代码在 git 上, 公司要求再放到 svn 上, 复制了代码, 导致 git 找不到 master, git push 的时候出现以下错误

// 错误代码
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

    git push origin HEAD:<name-of-remote-branch>

Xcode 上错误如图:

一直在 Loading

解决办法


  • git status 查看所有变化的文件, 把有改动的先删除 ps: 这个是从别的网站粘贴的, 个人觉得单纯删除不保险, 注意, 注意, 注意, 这里最好是将自己的项目 copy 一份到本地其他地方作为备份
  • git checkout master 回到主分支 ps:这里说白了就是回退到 master 主分支上这次修改的内容会消失
  • git pull 保证一下本地是最新代码
  • 然后将备份的内容 paste 就好了

相关文章

网友评论

      本文标题:使用 git 错误 You are not currently

      本文链接:https://www.haomeiwen.com/subject/syvwcqtx.html