在等待未决PR时工作 [英] Working while waiting for pending PR

查看:150
本文介绍了在等待未决PR时工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,并且提交了我的第一个拉取请求,而我在等待时,我想继续处理我的项目,这些项目是根据我在合并中尚未完成的工作建立的。现在我有:

  * master 
user_story_1

user_story_1 有一个公开的拉取请求。



现在我试着创建一个新的分支 user_story_2 ,我可以继续我在 user_story_1 。如何在Git中执行此操作而不会发生任何冲突或影响我的待处理合并? 我假设您想要在 user_story_1 中完成的工作之上启动新的 user_story_2 分支。下面是我在这种场景中使用的工作流程:
$ b


  1. 打开< user_story_1 $ b $ $ $ $ $ $ $ $ $ b $ $ $ $ $ $ )
    *
    *


  2. 创建新分支 user_story_2 基于 user_story_1

     $ git checkout -b user_story_2 user_story_1 



      *(user_story_1,user_story_2)
    *
    /
    * (master)
    *
    *




  3.   *(user_story_2)
    *
    *(user_story_1)
    *
    /
    *(master)
    *
    *


  4. Pull Request合并:

      *(user_story_2)
    *
    * | (主)
    | \ |
    | *(user_story_1)
    | *
    | /
    *
    *
    *


  5. 删除旧分支:

      *(user_story_2)
    *
    * | (主)
    | \ |
    | *
    | *
    | /
    *
    *
    *


  6. 将新分支重新分配到 master

      *(user_story_2 )
    *
    /
    *(master)
    | \
    | *
    | *
    | /
    *
    *
    *


  7. ol>

    I'm working on a project and I submitted my first pull request and while I'm waiting I want to continue on working on my project building up from what I worked on the merge that's still pending on. Right now I have :

    *master
    user_story_1
    

    user_story_1 has an open pull request.

    Now I'm trying to create a new branch user_story_2 where I can continue the work I left of at user_story_1. How can I do this in Git without getting into any conflict or affecting my pending merge?

    解决方案

    I'm assuming you want to start the new user_story_2 branch on top of the work you've done in user_story_1. Here's the workflow I use in this sort of scenario:

    1. Open Pull Request for user_story_1:

        * (user_story_1)
        *
       /
      * (master)
      *
      *
      

    2. Create new branch user_story_2 based on user_story_1:

      $ git checkout -b user_story_2 user_story_1

        * (user_story_1, user_story_2)
        *
       /
      * (master)
      *
      *
      

    3. Work on the new branch:

        * (user_story_2)
        *      
        * (user_story_1)
        *
       /
      * (master)
      *
      *
      

    4. Pull Request gets merged:

        * (user_story_2)
        *      
      * | (master)
      |\|
      | * (user_story_1)
      | *
      |/
      *
      *
      *
      

    5. Delete old branch:

        * (user_story_2)
        *      
      * | (master)
      |\|
      | *
      | *
      |/
      *
      *
      *
      

    6. Rebase new branch onto master:

        * (user_story_2)
        *      
       /
      * (master)
      |\
      | *
      | *
      |/
      *
      *
      *
      

    这篇关于在等待未决PR时工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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