如何从一个分支推到另一个以及结账? [英] How to push from one branch to another and checkout?

查看:78
本文介绍了如何从一个分支推到另一个以及结账?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行此处列出的设置 http://toroid.org/ams/git -website-howto ,但有一点不同。在我的本地存储库中,我想使用与master不同的分支。

因此,当我去推送初始文件而不是推送主文件时,我想推送文件从我的演示分支到远程存储库上的主分支。例如:

  git push web + master:refs / heads / demo 

但是,当我这样做时,在完成上传所有文件后出现以下错误:

 remote:fatal:你在一个分支尚未出生



<

解决方案

如果本地分支名为demo ,并且你想推到名为master的分支,然后执行以下操作:

  git推网络演示:master 

如果您想从远程web上的master分支进行合并到您当前的分支,您可以执行以下操作:

  git fetch web 
git merge web / master


I am trying to implement the setup outlined here http://toroid.org/ams/git-website-howto but with one difference. On my local repository I want to use a branch different to master.

So when I go to push the initial files rather than push the master files I want to push the files from my demo branch to the master branch on the remote repository. For example:

git push web +master:refs/heads/demo

But when I do this I get the following error after it completes uploading all of the files:

remote: fatal: You are on a branch yet to be born

Is it possible to do what I am trying to do with this setup?

解决方案

If the local branch is called "demo" and you want to push to branch called "master" on the remote called "web", then do the following:

git push web demo:master

If you want to merge from the "master" branch on the remote "web" into your current branch, you can do the following:

git fetch web
git merge web/master

这篇关于如何从一个分支推到另一个以及结账?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆