4

We were an SVN shop - now we use git (cos all the cool kids are doing it).

Each dev checks in code locally on their own git tree while working on new features. When some work is ready to submit to the main repository we have a directory on a shared drive for each project. We then do a git push to that repo, and either a git sync or git pull to update an individual dev machine from the 'one true source'.

We had one accident when someone did a push to the repository and somehow managed to replace the main repo with the dev machine's version of it's own git tree.

Is this the best 'git' way of doing things?

We are on two sites but the shared directory is common. A small number of devs who can generally avoid major clashes on the code area. All on Windows, using TortoiseGit, security is not too important but we have no admin support so a complex server solution is out.

4

4 回答 4

4

Git 很强大。它是分布式的,但如果您愿意,它不会限制您成为中心化的。

与 svn tho' 不同,设置自己的约定和做事方式非常重要。

下图说明了一个非常好的模型 在此处输入图像描述

来自流行的git 分支模型

于 2011-02-04T20:54:56.583 回答
3

查看以下链接中的工作流,我的偏好是集成管理器工作流(类似于@simon 的第二个选项)并且与 github 的模型相关:http: //progit.org/book/ch5-1.html

于 2011-02-04T21:09:47.893 回答
2

使用 git 的两种常见方式是:

  • 所有开发人员都从中央仓库拉出并推送到中央仓库(就像您现在所做的那样)

  • 每个开发者都有一个私人仓库和一个公共仓库。他从其他公共回购中提取他想要的东西,并只推送到他自己的公共回购。

如果您选择第二个选项并且您的代码不必是私有的,您可以使用github来简化您的生活。

于 2011-02-04T21:04:17.080 回答
0

在我们的项目中,我们有一个带有 gitosis 管理的存储库的中央服务器,有几个分支。从那里,每个开发人员拉取要处理的分支上的最新更改,进行自己的更改,在本地提交,当它可编译和测试时(如果可能)再次拉取(合并任何更改)并推送。

通常,没有太多中断的小功能直接在主分支中工作,而更大的更改首先在他们自己的分支上完成(可以通过这种方式由多个开发人员共享)。

不要忘记在使用完分支后删除它们,否则会造成混乱。我实际上有一个名为 的特殊分支branches,它在其决定点(分支、合并、结束)处跟踪git merge -s ours ...对所有其他分支的引用,所以即使我在没有真正合并的情况下删除一个分支(例如,因为我决定不去这个路线,或者它只是一些错误发现分支),我仍然有它的参考,并且可以在必要时恢复它。

于 2011-02-06T21:40:35.687 回答