Git分支vs Git分支 [英] Git branch vs Git fork

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

问题描述

我有一个普遍的疑问.假设有一个git repo以master分支作为开发分支,并且您想进行一些更改而不影响master分支,然后再合并它.有什么更好的方法?

I have a general doubt. Suppose there is a git repo with master branch as development branch and you want to make some changes without effecting master branch and then you want to merge it later. What is the better approach?

  1. 在相同的仓库中创建新分支,然后将其合并到master.
  2. 通过分叉创建新的存储库,然后将其合并到主库中.

推荐答案

如果您确定最终将与master分支合并和/或更改相对较小(错误修复,新功能),那么肯定会建立一个新的分支.仅当您要进行可能有可能本身成为一个新项目的巨大更改时,才可以使用.这是我遵循的经验法则(因为它遵循git的基本项目设计要素),所以希望对您有所帮助.

If you know for sure that you will end up merging with the master branch eventually and/or your change is relatively small (bug fixes, new features), then definitely make a new branch. Only make a fork if you are going to make vast changes that could potentially become a new project in itself. That's the rule of thumb that I follow (as it follows the basic project design meta of git), so I hope that helps.

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

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