我应该做一个git fork然后分支还是一个git分支 [英] should I do a git fork then branch or just a git branch

查看:430
本文介绍了我应该做一个git fork然后分支还是一个git分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在git和branching中没有做太多分支工作,所以请原谅这个菜鸟的本质.

I haven't done much branching work in git and branching so excuse the noob nature of this.

我将开始开发一个功能(例如"user oauth"),该功能我想单独工作并在以后合并.理想情况下,我将在稍后将其合并到master分支中.显然,我想在一个单独的分支中进行.在我的本地实例中仅做一个分支是一般的做法,还是我应该分叉存储库并在新的单独文件夹结构中创建一个分支.在我看来,如果我只想清除分支,可以删除其他文件夹结构,后者似乎更好.

I'm going to start working on a feature (say 'user oauth') that I want to work in isolation and merge in at a later point. Ideally, I will be merging this into the master branch at a later point. Obviously, I'd like to do in a separate branch. Is it general practice to just do a branch in my local instance or should I fork the repo and create a branch in the new separate folder structure. In my mind, the latter seems better in case I just want to wipe out the branch, I can just delete this other folder structure?

thx

每个ryan修改1

git clone git@github.com:xxx/xxx.git  
git branch test-feature-branch

修改2 哇,谢谢你的信息这可能是第二个应用程序.有没有办法我可以克隆它,然后将其作为新的存储库推送到新的github?

edit 2 wow, thx for information. It's possible that this will be a second application. Is there a way I can clone it and then essentially push it as a new repository to new github?

推荐答案

git克隆和分支的全部要点是不必制作单独的存储库.分叉实际上只是克隆的另一个名称,因此,您可以在本地克隆中同时为多个功能创建分支,选择并选择要推送到远程和/或合并到其他分支(或丢弃)的那些分支. ).

The whole point of git cloning and branches is that making separate repos is not necessary. A fork is really just another name for a clone and as such, you can make branches for multiple features at the same time within your local clone, picking and choosing which ones to push to the remote and/or merge into other branches (or discard).

有关更多详细信息,请参见此问题的答案: git分支,派生,获取,合并,变基和克隆,有什么区别?

See the answers to this question for more details: git branch, fork, fetch, merge, rebase and clone, what are the differences?

这篇关于我应该做一个git fork然后分支还是一个git分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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