You are not currently on a branch

这篇具有很好参考价值的文章主要介绍了You are not currently on a branch。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

今天git push提交代码时候报了一个错

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.

这个报错的意思就是你不在分支上,没办法提交。
你需要创建一个临时分支,基于这个临时分支,将你的代码合并到master分支上。合并后删除这个临时分支就行了。

  1. 首先使用git branch命令查看所在的位置
 git branch
 1. (HEAD detached from bdcfe3a8)
 2. master
 3. issue699

当前位置是:HEAD detached from bdcfe3a8上
2. 创建临时分支,合并代码到master

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

这个时候代码已经合到master了,可以把临时分支temp 删除文章来源地址https://www.toymoban.com/news/detail-784672.html

git branch -d temp

到了这里,关于You are not currently on a branch的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • 解决Gitlab报错You are not allowed to force push code to a protected branch on this project.

    解决Gitlab报错You are not allowed to force push code to a protected branch on this project.

    在使用 -f 强推时报错: 设置界面中, Settings - Reporsitory ,查看选项卡 Protected branches 把 Allowed to force push 这个选项打开,然后就可以了

    2024年02月05日
    浏览(11)
  • git 出现 There is no tracking information for the current branch. Please specify which branch you want

    git 出现 There is no tracking information for the current branch. Please specify which branch you want

    问题分析:当前pull对象没有远程分支的跟踪信息,简单地来说就是你创建的这个分支没有和远程仓库中的其他分支或者master建立联系,所以导致当前分支无法进行pull操作; 解决方案: git branch --set-upstream-to=origin/remote_name local_name 注解: remote_name : 远程分支名 // 这里是你创

    2024年02月05日
    浏览(18)
  • git 删除分支 The branch ‘xx‘ is not fully merged.If sure you want to delete it, run ‘git branch -D xx‘

    删除本地分支时,报了这个错:  error: The branch \\\'xxx\\\' is not fully merged. If you are sure you want to delete it, run \\\'git branch -D xxx\\\'. 如果本地分支没有合并到其他分支,或者没有对应的远程分支,删除时则会提示这个错误。 强制删除即可。 之所以会需要这样提示,是因为通常创建分支就是

    2024年02月05日
    浏览(13)
  • git reset current branch to here

    git reset current branch to here

    reset current branch to here是git命令中的一种回滚操作。 其使用场景如下, 1)提交了多次错误的提交,想回滚到之前的某次提交。 2)合并了错误的分支,想回滚到合并之前。 该操作回滚到某次commit提交后,该commit提交之后提交的代码都可以再次修改重新提交。 另外,还有一种

    2024年01月19日
    浏览(10)
  • 无法连接仓库:Command “git ls-remote -h xxx stderr: remote: You are not allowed to download code from

    无法连接仓库:Command “git ls-remote -h xxx stderr: remote: You are not allowed to download code from

    自己jenkins打包的时候,突然在设置里面报以下错误: 无法连接仓库:Command \\\"git ls-remote -h -- http://gitlab.rd.unicloud.com/unicloud/pco/uco-ui-delivery-console.git HEAD\\\" returned status code 128: stdout: stderr: remote: You are not allowed to download code from this project. fatal: unable to access \\\'http://gitlab.rd.unicloud.com/u

    2024年02月12日
    浏览(11)
  • 【git报错】The current branch dev has no upstream branch. To push the current branch and set the remote

    【git报错】The current branch dev has no upstream branch. To push the current branch and set the remote

    发现问题 本地新建了一个dev分支,然后把dev分支下的代码push到远程仓库中,使用git push,但是报错了,如下: fatal: The current branch dev has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin dev 翻译 错误:当前分支:dev没有远程对应的dev分支

    2024年02月11日
    浏览(15)
  • idea的git reset current branch to here操作详解

    分为四个选项 Soft : 这个选项执行 git reset --soft 命令。 它会重置当前分支到指定的提交,但不改变工作目录或暂存区(Staging Area)。 你的所有更改会被保留并标记为待提交(即,更改会移动到暂存区)。 场景: 当你想要撤销一些提交,但仍希望保留这些更改以进行进一步的修

    2024年01月23日
    浏览(10)
  • Git提示Please tell me who you are(git提示Author identity unknown,git报错Please tell me who you are)

    Git提示Please tell me who you are(git提示Author identity unknown,git报错Please tell me who you are)

    Author identity unknown        译:作者身份未知 Please tell me who you are         译:请告诉我你是谁 原因: 这种情况一般都发生在更换设备后,在执行git commit命令时,出现的提示; 这说明你虽然把代码拉下来了,但是在推送代码时不知道你是谁,所以需要执行两行命令,告诉它

    2024年02月16日
    浏览(11)
  • git 不小心操作 reset current branch to here后,怎么还原

    可以通过reflog来进行恢复,前提是丢失的分支或commit信息没有被git gc清除 一般情况下,gc对那些无用的object会保留很长时间后才清除的 可以使用git reflog show或git log -g命令来看到所有的操作日志 恢复的过程很简单: 通过git log -g命令来找到需要恢复的信息对应的commitid,可以通

    2024年04月13日
    浏览(10)
  • git远程连接推送代码报错 fatal: The current branch master has no upstream branch.

    fatal: The current branch master has no upstream branch. To push the current branch and set the remote as upstream, use     git push --set-upstream origin master To have this happen automatically for branches without a tracking upstream, see \\\'push.autoSetupRemote\\\' in \\\'git help config\\\'. 报错原因:当前的分支 \\\"master\\\" 没有与远程分支关联(也

    2024年02月05日
    浏览(10)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包