Git切换分支 [英] Git Switching branch

查看:121
本文介绍了Git切换分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有些东西我还没有用git。它是分支。
因此,假设我有一个本地仓库 A ,我从远程仓库克隆 B
所以现在 A 已经检出了主分支。所以当我从 A 它转到 B master。



B 仅仅是github上的一个克隆,它是 C 的一个克隆。



From在其他时间与我同步拉动从 C master分支。



但现在 C master分支暂时相当破裂。
A 以来,我从 C >我的本地 A 也是bugy。



所以我想从 A 取消 C 稳定分支。
在这种情况下,你们通常会怎么做?


您是否在 A 并从 C 拉。但是因为 A C 主变更,所以我需要先将它还原...


git checkout C / stable-branch
git checkout -b myCopy

然后 myCopy 是本地(复制) C稳定的分支。

There is somthing I don't get yet with git. It is branch. So let say that I have a local repository A which I clone from a remote one B. So now A have the master branch checked out.

So when I push from A it goes to B master.

B is just a clone on github, a clone of C.

From time to time in other to get in sync I pull from C master branch.

But now C master branch is quite broken for the time being. Since from A I had pull from C my local A is also bugy.

So I would like from A to pull the C stable branch. How do you guys usually do in this situation?

Do you create a new branch on A and pull from C. But since A have the C master change I need to revert it first...

解决方案

git fetch C
git checkout C/stable-branch
git checkout -b myCopy

Then myCopy is a local (copied) branch of C's stable one.

这篇关于Git切换分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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