Client& Git的Git分支结构服务器 [英] Git branch structure for Client & Server

查看:56
本文介绍了Client& Git的Git分支结构服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的一个CS类,我和一个小组正在使用客户端/服务器体系结构编写应用程序.我很好奇在Git存储库中组织项目的最佳实践是什么.我的意思是,是否应该像这样构造目录:

For one of my CS classes, I and a group are writing an application using a client/server architecture. I was curious what the best-practices would be for organizing the project in a Git repository. What I mean, is whether we should structure the directories like this:

ProjectDir/
    Clients/
        Client1/
            # files...
        Client2/
            # files...
    Server/
        files....

并跟踪同一git分支上的所有内容,或者是否应该为客户端和服务器创建单独的分支,例如:

and track everything on the same git branch, or whether we should create separate branches for the clients and the server, like:

在分支Server上:

Project/
    Server/
        # files...

在分支Clients上:

Project/
    Client1/
        # files...
    Client2/
        # files...

我不知道这是否有很大的不同,但这将是我使用git进行的第一个项目,该团队由多个人组成,并且我想确保合并和合并尽可能简单...

I don't know if it makes much of a difference, but this will be the first project I undertake using git where the team consists of more than a couple people, and I want to make sure the pulls and merges are as simple as possible...

推荐答案

我不确定您的背景是什么,但我听到过来自同一人群的人们反复问过同样的问题像SVN这样的中央VCS. SVN(集中式)和Git之间的分支之间的根本区别在于,Git分支非常轻便,并且比较容易.毕竟,在Git中,分支不过是一个标记的提交(该提交指向一个指向该提交的提交,一直到分支收敛为止).

I'm not sure what you're background is, but I've heard the same (similar) question asked over and over from people who are coming from central VCS like SVN. The fundamental difference between branches between SVN (centralized) and Git is that Git branches are very light and easy in comparison. After all, in Git, a branch is nothing more than a labeled commit (and the commit points to a commit that points to a commit, down the line until branches converge).

在SVN中,通常将完全独立的项目作为单独的子目录托管在同一资源库中.这些不是分支,但是在SVN中,它们看起来与分支没有区别(在SVN中,分支不比子目录多得多).但是,您应该了解分支是什么.分支是并行修改和开发的同一软件的两个近副本.如果不确定是否有分支机构,请问自己这些分支机构是否会融合或曾经融合.如果让分支汇合永远不会有意义,那么它们可能根本就不是分支.

In SVN it's common to host entirely separate projects in the same repository as separate sub-directories. These aren't branches, but in SVN they look indistinguishable from branches (in SVN branches aren't much more than sub-directories). However, you should understand what a branch is. A branch is two near-copies of the same piece of software that are being modified and developed in parallel. If you're unsure if you have a branch, ask yourself if these branches will or could ever converge. If it would never make sense to have the branches converge, they're probably not branches at all.

在您的客户端-服务器程序中,我建议您的客户端&服务器不是分支机构.相反,它们是独立的存储库.如果您希望看到它们的历史记录是分开的,请将它们放在单独的存储库中.如果要一起查看它们的历史记录,请将它们放在相同的存储库中,但在不同的目录下.

In you're client-server program, I would suggest that your client & server aren't branches. Rather, they're separate repositories. If you value seeing their history separate, put them in separate repositories. If you want to see their history together, put them in the same repository but under separate directories.

Git一个有趣的功能是,由于它具有分布式特性,因此您可以将客户端和服务器维护在单独的存储库中,然后将它们作为不同分支推送到同一存储库中.除了发疯去理解之外,几乎没有什么区别.

An interesting feature of Git is that, due to it's distributed nature, you could maintain the client and server in separate repositories and then later push them into the same repository as different branches. There would be little difference except being insane to try to understand.

这篇关于Client& Git的Git分支结构服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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