在多用户环境中使用 git 决定应该实现什么、不应该实现什么

发布于 2024-12-26 12:15:46 字数 168 浏览 1 评论 0原文

使用它的两种方法。

  1. 我开始使用 git,并且已经知道作为单个开发人员
  2. 和多个开发人员

第二种方法很好,但我需要控制哪些文件应该真正放入主分支中。我听说过使用 git 的第三种方法,您可以作为某种管理员来决定什么进入存储库以及什么不应该进入存储库。

I started using git and already know two ways to use it

  1. as a single developer
  2. as multiple developers

The 2nd way is nice, but I need to control, what files should really be taken into the master-branch. I heard of a 3rd way to use git, where you can be some sort of an Admin to decide what's coming into the repository and what should not come into it.

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

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

发布评论

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

评论(3

红ご颜醉 2025-01-02 12:15:46

您可以使用独裁者中尉工作流程。这意味着只有一个人(独裁者)被允许推送到主仓库(“受祝福的仓库”)。其他开发人员有自己的存储库。当他们觉得自己已经准备好了一些东西时,他们会通知独裁者,他会提取他们的更改并将它们合并到主存储库中。这就是 Linux Torvalds 和他的团队用来开发 Linux 内核的工作流程。

请参阅http://progit.org/book/ch5-1.html

You can use the Dictator-Lieutanant workflow. This means that only one person (the dictator) is allowed to push to the main repo (the "blessed repo"). The other developers have their own repository. When they feel that they got something ready, they notify the dictatorm and he pulls in their changes and merges them into the main repository. That is the workflow that Linux Torvalds and his people use to develop the Linux kernel.

See http://progit.org/book/ch5-1.html

鼻尖触碰 2025-01-02 12:15:46

Git 的好处是它允许您轻松快速地分叉存储库(制作单独的副本)和合并(从单独的副本中进行更改并将其放入原始副本中)。为了实现您想要做的事情,您只需让您的团队成员分叉主存储库并在本地进行更改(提交到他们自己的存储库或分支,而不是主存储库或分支)。当他们完成一段代码后,他们会向您提交拉取请求,您可以选择是拉取所有更改、部分更改还是不拉取任何更改。

如果您仍在通过终端工作,您可能需要考虑使用 git 托管服务,例如 http://www. github.com/ 允许您在一个漂亮的图形界面中完成大部分工作(更不用说一些很棒的方法来可视化您的存储库中发生的情况)。它们还具有鼓励多用户环境的功能以及对公众隐藏的私人存储库(您选择谁可以看到它)。

The benefit of Git is it allows you to fork repositories (make a separate copy) and merge (bring changes from the separate copy and put them in the original) easily and quickly. To achieve what you're looking to do, you simply have your team members fork the main repository and make the changes locally (committing to their own repo or branch, rather than the main one). When they're finished with a piece of code, they submit a pull request to you, and you choose whether to pull in all of the changes, some of them, or none of them.

If you're still working via terminal, you may want to look into using a git hosting service such as http://www.github.com/ that allows to you do most of this in a nice graphical interface (not to mention some awesome ways to visualize what's happening in your repo). They also have features that encourage multi-user environments as well as private repos that are hidden from the public (you choose who can see it).

冰葑 2025-01-02 12:15:46

如果您想成为唯一的管理员,这很简单:您不授予其他任何人对中央存储库的写入权限。然后有几种主要方法可以从其他人那里获取更改:从他们公开发布的克隆中提取,或者让他们提交补丁。很多人以这种方式使用 GitHub:每个人都有自己的公共存储库,只有他们可以写入(您的是官方的),然后您从他们的存储库中提取。

如果您希望多人能够推送到中央存储库以进行自托管,您可能需要查看 Gitolite,这将让一个或多个管理员决定其他人可以做什么,如果你愿意的话,可以细化到每个分支的级别。例如,您可以让自己成为唯一可以推送到主分支的人,并让其他人推送到他们的个人分支,然后您可以决定是否合并。这是相当灵活的。您还可以仍然使用 GitHub 之类的东西,多人能够推送到中央存储库,但您不会拥有每个分支的控制权或任何东西;你必须完全信任有权访问的人。

If you want to be the sole admin, it's easy: you don't give anyone else write access to the central repository. There are then a couple primary ways to get changes from others: pull from clones that they publish publicly, or let them submit patches. A lot of people use GitHub this way: everyone has their own public repository that only they can write to (yours is the official one), and you pull from theirs.

If you want multiple people to be able to push to the central repository, for self-hosting, you'll probably want to look at Gitolite, which will let one or more admins determine what everyone else is allowed to do, down to a per-branch level if you want. For example, you could make yourself the only one who can push to the master branch, and let everyone else push to their personal branches, which you can then decide whether to merge. It's quite flexible. You could also still use something like GitHub with multiple people able to push to the central repo, but you won't have per-branch control or anything; you have to fully trust the people who have access.

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