如何关闭Git分支? [英] How to close off a Git Branch?

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

问题描述

所以我开始使用Git + GitHub。

在我们的小分布式团队中,每个成员都为他们分配的每个问题/需求创建自己的分支。


$ b $ ol
  • git branch问题#1< - 创建这个分支

  • git checkout issue#1< - 切换到此分支



  • 现在代码代码提交代码 code>, commit 等等...



    然后 pull request code-fixup commit code commit .. etc。

    和FINALLY ... pull请求被接受。



    Woot。



    但是..现在是什么? (......尴尬......)

    在本地开发机器上创建分支的人是否需要关闭分支?一个建议是让开发人员删除分支`(... -D ...),然后进行主/从的刷新/刷新,然后获得他们所有的分支代码。



    hmmmmm ...不确定 - 请帮忙:)

    解决方案

    我们要求开发者询问对于请求状态,他们希望分支被删除。大多数情况下都是这样。有时候需要一个分支(例如,将更改复制到另一个发布分支)。

    我的手指记住了我们的过程:

      git checkout< feature-branch> 
    git pull
    git checkout< release-branch>
    git pull
    git merge --no-ff< feature-branch>
    git push
    git tag -a branch-< feature-branch> -m将<特征 - 分支>合并到<发行 - 分支>中
    git push --tags
    git branch -d< feature-branch>
    git push origin:< feature-branch>

    分支是为了工作。一个标签及时标记一个地方。通过标记每个分支合并,我们可以在需要时重新生成分支。分支标签已被多次使用来查看更改。


    so i'm starting out using Git + GitHub.

    In our little distributed team, each member is creating their own branch for each issue/requirement they are allocated.

    1. git branch Issue#1 <-- create this branch
    2. git checkout issue#1 <-- switch over to this branch

    now code code, commit, code, commit, etc...

    then pull request, code-fixup, commit, code, commit .. etc.

    and FINALLY ... pull request is accepted.

    Woot.

    but .. now what? (......awkward......)

    Does the person who created the branch on their local dev machine need to .. close off the branch? A suggestion was for the dev person to delete the branch `( ... -D ...) and then do a pull / refresh of the master .. which then will get all their branch code.

    Hmmmmm... not sure - please help :)

    解决方案

    We request that the developer asking for the pull request state that they would like the branch deleted. Most of the time this is the case. There are times when a branch is needed (e.g. copying the changes to another release branch).

    My fingers have memorized our process:

    git checkout <feature-branch>
    git pull
    git checkout <release-branch>
    git pull
    git merge --no-ff <feature-branch>
    git push
    git tag -a branch-<feature-branch> -m "Merge <feature-branch> into <release-branch>"
    git push --tags
    git branch -d <feature-branch>
    git push origin :<feature-branch>
    

    A branch is for work. A tag marks a place in time. By tagging each branch merge we can resurrect a branch if that is needed. The branch tags have been used several times to review changes.

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

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