没有服务器的Git工作流程 [英] Git workflow without a server

查看:89
本文介绍了没有服务器的Git工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git应该是一个去中心化的系统,但是所有教程和我在Google上发现的最佳做法工作流建议使用服务器(通常是GitHub,或自行设置)

我正在将git用于小型个人项目(2-3人),在哪里可以找到直接在团队成员机器之间同步更改的最佳实践工作流.

或者,为什么我应该避免这种情况,而要设置中央"服务器呢?

解决方案

取决于服务器"的含义.尽管许多团队发现拥有中央存储库很方便,但是Git可以在没有中央服务器的情况下愉快地工作.

如果用服务器"来表示安装服务器软件",则git也可以通过ssh或在文件系统上运行(无论是否有中央存储库),而无需任何特殊软件.

有关可能的工作流程,请参阅此文档

具有通用存储库的工作流

许多人使用的工作流程是所有开发人员推"(将其更改)发送到一个公共存储库,并从该存储库中获取所有更改.像这样:

  • 开发者A推向中心
  • 开发者B推向中心
  • 开发人员C拉动(从A和B中获取更改)
  • 开发人员A拉动(从B获取更改)
  • ...

在这种情况下,中央存储库可以位于开发人员计算机之一,github上或任何其他地方

电子邮件工作流程

您还可以在不使用任何服务器的情况下使用git,而仅使用电子邮件.在这种情况下,流程如下:

  • 开发人员A将更改作为电子邮件发送给团队
  • 其他开发人员应用电子邮件中的更改

这甚至可以半自动化的方式完成

没有中央服务器的工作流程

您可以将git设置为使用多个远程"菜单.资料库.需要注意的是,您不应该从不推送到已签出的存储库(即有人正在使用的开发人员副本).因此,在这种情况下,流程将如下所示:

  • 开发者A进行更改
  • 开发人员B进行更改
  • 开发人员C从A提取更改
  • 开发人员C从B提取更改
  • 开发者B从A提取更改
  • ...
  • 没有人可以推动

恕我直言,这种类型的工作流程将迅速导致混乱和崩溃.

Git is supposed to be a decentralized system, but all the tutorials and best practice workflows I have found on Google suggest using a server (usually GitHub, or else set up your own)

I am using git for small personal projects (2-3 people), where can I find a best practice workflow for syncing changes directly between the team members machines.

Alternatively, what are some compelling arguments for why I should avoid this and instead set up a 'central' server?

解决方案

Depends on what you mean by "server". Git will work happily without a central server, although many teams find it convenient to have a central repository.

If by "server", you mean "install server software", git will also work (central repository or not) without any special software, through ssh or on the file system.

See this document for possible workflows

Workflow with common repository

The workflow that many use is that all developers "push" (send) their changes to a common repository, and get all the changes from that repository. Something like this:

  • Developer A pushes to central
  • Developer B pushes to central
  • Developer C pulls (getting changes from A and B)
  • Developer A pulls (getting changes from B)
  • ...

In this case the central repository can be on one of the Developers computers, on github, or any other place

Workflow with Email

You can also use git without any server, just using email. In this case the flow would be like this:

  • Developer A sends changes as an email to the team
  • Other developers apply the changes from the emails

This can even be done in a semi-automated way

Workflow without a central server

You can setup git to use more than one "remote" repository. The caveat is that you should never push to a repository that is checked out (that is, a Developer copy on which someone is working). So in this case the flow would be like this:

  • Developer A makes changes
  • Developer B makes changes
  • Developer C pulls changes from A
  • Developer C pulls changes from B
  • Developer B pulls changes from A
  • ...
  • No one must ever push

IMHO this type of workflow will quickly lead to confusion and breakdown.

这篇关于没有服务器的Git工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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