首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >git : remote HEAD是模糊的--如何将更改推送到另一个分支而不是克隆的分支?

git : remote HEAD是模糊的--如何将更改推送到另一个分支而不是克隆的分支?
EN

Stack Overflow用户
提问于 2016-02-08 07:40:25
回答 1查看 414关注 0票数 1

我克隆了一个远程代表,,并做了一些更改。在推送更改之前,管理员已经创建了开发分支。

现在,"git远程显示原点“命令显示了下面的模糊头分支。

代码语言:javascript
运行
复制
  HEAD branch (remote HEAD is ambiguous, may be one of the following):
    development
    master
  Remote branches:
    development new (next fetch will store in remotes/origin)
    master      tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

我已经对克隆的进行了更改。现在,如何将更改推送到新创建的开发分支?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-02-08 08:36:01

如果希望将名为development的本地分支“链接”到远程development分支,则从当前状态(例如:具有额外提交的master分支)运行:

代码语言:javascript
运行
复制
# create a new branch on the current commit, and switch to it :
$ git checkout -b development  

# push your moidifcations to the remote "development" branch,
# and tag your local branch to follow the remote "development" branch :
$ git push --set-upstream origin development

如果您想要推送到任何远程分支:

代码语言:javascript
运行
复制
git push origin mylocalbranch:remotebranch
# for example :
git push origin master:development

# if you add '-u' or '--set-upstream', your local branch will
# follow the remote branch :
git push -u origin mylocalbranch:remotebranch
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35264528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档