Githug第42关rebase_onto通关秘籍

简介: Githug是一个用来了解、熟悉Git的一个非常好的游戏。目前网站上收录的都是之前只有55关的解题方法,没有新增的rebase_onto这一关的内容。现在Githug一共有56关。

Githug是一个用来了解、熟悉Git的一个非常好的游戏。

目前网站上收录的都是之前只有55关的解题方法,没有新增的rebase_onto这一关的内容。现在Githug一共有56关。现将新增的42关的解答内容更新如下:

第42关的题目如下:

Name: rebase_onto
Level: 41
Difficulty: **

You have created your branch from `wrong_branch` and already made some commits, and you realise that you needed to create your branch from `master`. Rebase your commits onto `master` branch so that you don't have `wrong_branch` commits.

通过查找,在git rebase中有以下用法:

Here is how you would transplant a topic branch based on one branch to another, to pretend that you forked the topic
       branch from the latter branch, using rebase --onto.

       First let's assume your topic is based on branch next. For example, a feature developed in topic depends on some
       functionality which is found in next.

               o---o---o---o---o  master
                    \
                     o---o---o---o---o  next
                                      \
                                       o---o---o  topic

       We want to make topic forked from branch master; for example, because the functionality on which topic depends was
       merged into the more stable master branch. We want our tree to look like this:

               o---o---o---o---o  master
                   |            \
                   |             o'--o'--o'  topic
                    \
                     o---o---o---o---o  next

       We can get this using the following command:

           git rebase --onto master next topic

所以,第42关的通关方法如下:

 git rebase --onto master wrong_branch readme-update

祝通关顺利!

目录
相关文章
|
10月前
|
Java 容器
膜拜!清华大佬手撸多线程并发源码笔记Github上线3天星标35k+
你为什么要学习多线程?是因为理想吗?是因为热爱吗? 哦~原来是为了面试打基础、做准备啊!没错,这真的很现实!
膜拜!清华大佬手撸多线程并发源码笔记Github上线3天星标35k+
|
存储 安全 算法
万字讲解 Git 的使用!错过就太后悔了!
万字讲解 Git 的使用!错过就太后悔了!
60 0
|
缓存 Ubuntu Linux
|
开发工具 git
热饭面试复习【git操作命令】完
热饭面试复习【git操作命令】完
热饭面试复习【git操作命令】完
|
存储 安全 IDE
Git 入门看这一篇就够了!程序员防被diss必会技能走一波
今天简单讲下 Git 的实现原理,知其所以然才能知其然;并且梳理了日常最常用的 12 个命令,分为三大类分享给你。 如果觉得不错的话,一定要点个关注哦 本文的结构如下: 作者和开发原由 Git 的数据模型 常用命令 资源推荐 作者和开发原由 Talk is cheap. Show me the code. 这句话就出自 Linux 和 Git 的作者Linus Torvalds。 原本 Linux 内核的版本控制系统是用的 BitKeeper,然而 2005 年,BitMover 公司不再让 Linux 开发团队免费使用了。。 Linus 一听,不给用了?老子自己写!
Git 入门看这一篇就够了!程序员防被diss必会技能走一波
|
开发工具 git
猿猿有责,维持整洁的 Git 提交记录,三个锦囊送给你
猿猿有责,维持整洁的 Git 提交记录,三个锦囊送给你
猿猿有责,维持整洁的 Git 提交记录,三个锦囊送给你
|
缓存 编译器 开发工具
|
安全 机器人 Java
|
运维 Kubernetes Cloud Native
还不来试试云效?
云效,云原生时代一站式BizDevOps平台,支持公共云、专有云和混合云多种部署形态,通过云原生新技术和研发新模式,助力创新创业和数字化转型企业快速实现研发敏捷和组织敏捷,打造“双敏”组织,实现 10 倍效能提升。
390 0
还不来试试云效?
|
存储 开发工具 git
吐血整理,全网最全Git命令手册(上)
吐血整理,全网最全Git命令手册(上)