使用 Git 的编码人员协作最佳实践

发布于 2024-08-18 22:54:12 字数 1436 浏览 12 评论 0原文

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

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

发布评论

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

评论(2

一花一树开 2024-08-25 22:54:12

程序员不需要创建自己的分支来工作。在最简单的情况下,程序员将提交到自己存储库的“master”分支,然后将这些提交提交到上游存储库。

要部署到生产服务器,一种方法是在生产服务器上使用 git clone 来获取本地存储库。然后,要更新生产服务器,请登录并git pull。将应用已提交到主存储库的任何更改。

开发人员可以选择创建自己的分支供自己使用(仅在本地存储库中),或与其他人共享分支(通过将分支推送到共享存储库)。

It is not required for programmers to create their own branch to work. In the simplest case, programmers will commit to the "master" branch of their own repository, then git push those commits to the upstream repository.

To deploy to a production server, one way to do it is to use git clone on the production server to get a local repository. Then, to update the production server, log in and git pull. Any changes that have been committed to the main repository will be applied.

Developers can optionally create their own branches for either their own use (in their local repository only), or branches for sharing with others (by pushing the branches up to the shared repository).

黯然 2024-08-25 22:54:12
  1. 每个开发人员都将拥有自己的存储库克隆。他们可以根据需要为主题工作创建分支。他们的个人克隆是他们自己的地盘,他们可以做任何他们想做的事情。

  2. 每个开发人员都应该拥有自己的远程公共存储库,他们可以向其推送/拉取。通常,如果您想发布代码,将有一个人最终决定发布哪些内容以及删除哪些内容。该人的远程存储库应该有一个代表稳定版本的分支。假设 A 是发布经理,想要将 B 的工作合并到发布中。然后A将等待B将他的工作推送到他自己的远程仓库。然后 A 将 B 的工作拉到他的本地克隆,尝试、合并、提交并推送到他自己的(A)公共存储库以进行发布。

在 (2) 中,我仅描述了可与 git 等分布式 SCM 一起使用的多种不同工作流程之一。还有很多其他的。这个来自 Pro-Git 的页面在描述其他一些页面时特别好。

  1. Each developer will have their own clone of the repository. They can create branches for topic work as and when they want to. Their personal clone is their own turf, they can do whatever they want.

  2. Each developer should have their own remote public repository, which they can push/pull to/from. Typically, if you want to release code, there will be one person who finally decides what is going to go into the release and what gets cut out. That person's remote repository should have a branch which represents stable releases. Say A is the release manager who wants to incorporate B's work into the release. Then A will wait until B pushes his work to his own remote repo. Then A will pull B's work to his local clone, try things out, merge, commit, and push to his own (A's) public repo for release.

In (2) I've described only one of the many different workflows that are available for use with a distributed SCM like git. There are many others. This page from Pro-Git is especially nice in describing some others.

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