这里有人自己分叉吗?

发布于 2024-09-25 08:47:26 字数 82 浏览 1 评论 0原文

我一直使用 git 来完成我的单人任务,但我倾向于只做master

即使只有我一个人,我也应该尝试分叉吗?

I use git all the time for my solo missions but I tend to just work the master.

Should I try forking even if it's just me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮年慕年 2024-10-02 08:47:26

即使只有你一个人,我也会建议你尝试一下 git 的主题分支工作流程。首先也是最重要的是要对其有一个感觉,以便在参与更大的项目后可以应用它。

$ git branch usb_support
$ git checkout usb_support
.. hack hack hack ..
$ git checkout master
$ git merge usb_support

显然,如果你想工作,你也可以切换到不同的分支
在其他事情上。即使你只是独自一人,你也可能会开始做某件事,后来才意识到这是一个坏主意。在这种情况下,你可以扔掉你的主题分支,不要污染主分支。当然,如果这是一个没有其他人会看的项目,即使在主分支中也没有那么重要。但获得经验的论点仍然有效。

Even if it's just you I would suggest you to try the topic-branch workflow of git. First and foremost to get a feeling for it so you can apply it once you take part in bigger projects.

$ git branch usb_support
$ git checkout usb_support
.. hack hack hack ..
$ git checkout master
$ git merge usb_support

Obviously you can also switch to a different branches in between if you feel like working
on something else. Even if you are just on your own it happens that you start working on something only to later realize that it was a bad idea. In that case you can just throw away your topic branch and don't pollute the master branch. Of course if it's a project that nobody else will ever look at it does not matter that much even in the master branch. But then the gaining-experience-argument is still valid.

司马昭之心 2024-10-02 08:47:26

分叉是指在远程端克隆一个存储库,因为您没有直接的凭据来推送主要的公共存储库
这就是为什么 GitHub 引入了 forking (这只不过是 git clone --bare 在 GitHub 服务器端)。

如果您确实有权直接推送到 git 存储库,则不需要分叉它(意味着在远程端建立第二个“公共”存储库)。

分叉与您在客户端(即在您的工作站上)执行的 git 克隆不同:在那里(在本地端)您可以根据需要多次克隆。


这就是为什么 Chris Heilmann 将拥有 这张幻灯片在他的Fronteers 2010 的“快乐的理由”演示文稿 (荷兰前端开发者的非盈利贸易组织),明年 10 月。

替代文字
CC 许可证

如果您无法直接为某个项目做出贡献远程 Git 存储库,因为您想引入激烈的代码,您可以在远程端分叉,在本地端克隆并拉/推您想要的内容。

Forking is about cloning a repo on the remote side, because you don't have direct credential to push on the main common repo.
That is why GitHub introduced forking (which is nothing else than a git clone --bare on the GitHub server side).

If you do have the right to push directly to a git repo, forking it (meaning establishing a second "common" repo on the remote side) is not needed.

Forking is not like a git clone you would do on the client side (i.e. on your workstation): there (on the local side) you can clone as many time as you want.


That is why Chris Heilmann will have this slide in his "Reasons to be cheerful" presentation of Fronteers 2010 (a non-profit trade organization of Dutch front-end developer), next October.

alt text
CC license

If you cannot directly contribute to a remote Git repo because you want to introduce drastic code, you can fork on the remote side, clone on the local side and pull/push at your heart's content.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文