简体   繁体   English

在共享环境中进行开发的Git工作流程

[英]Git workflow for development in a shared environment

I am trying to figure out the best git branch model and workflow for our case. 我试图找出适合我们案例的最佳git分支模型和工作流程。 We have a pretty special setting: developers don't have a local environment, all use the same shared environment. 我们有一个非常特殊的设置:开发人员没有本地环境,所有人都使用相同的共享环境。

Since our environment difficult to replicate, we use a shared environment for development. 由于我们的环境难以复制,因此我们使用共享环境进行开发。 Modifications are uploaded to this shared environment to be executed and evaluated. 修改将上传到此共享环境以执行和评估。

However, sometimes developers step on other's toes by updating the same file separately and causing other people's work being overwritten. 但是,有时开发人员通过单独更新同一文件并导致其他人的工作被覆盖而踩在别人的脚上。

We have also an staging and production environment used for our testing and release process. 我们还有一个用于测试和发布过程的暂存和生产环境。

Does anybody know a git branching model that could fit our setting? 有人知道适合我们设置的git分支模型吗?

I have been in your shoes. 我去过你的鞋子。 I assume you mean that you use a shared working directory where your code (scripts?) lives and is in use by your webserver or whatever, and everyone is accessing that (ie, the running code is your single shared working space at the same time) 我假设您的意思是您使用共享的工作目录 ,其中的代码(脚本?)位于其中,并且由Web服务器或其他任何设备使用,并且每个人都在访问该目录(即, 正在运行的代码同时是您的单个共享工作空间) )

One model would be: 一种模型是:

  • Every dev gets his own clone of the repository, and is only allowed to git add ; git commit 每个开发人员都会获得自己的存储库克隆,并且只能git add ; git commit git add ; git commit in that directory. git add ; git commit在该目录中。
  • If a developer wants to modify the "live" working directory, he can only do so by doing a git pull ; git checkout xyz-branch 如果开发人员想要修改“实时”工作目录,则只能通过执行git pull ; git checkout xyz-branch git pull ; git checkout xyz-branch in that directory. git pull ; git checkout xyz-branch在该目录中。 It is for purposes of this relatively inconsequential which branching regime you use. 出于这种相对无关紧要的目的,您使用了哪种分支方式。 You can use the standard "gitflow" http://nvie.com/posts/a-successful-git-branching-model/ , or my personal favourite http://dymitruk.com/blog/2012/02/05/branch-per-feature/ . 您可以使用标准的“ gitflow” http://nvie.com/posts/a-successful-git-branching-model/ ,或者我个人最喜欢的http://dymitruk.com/blog/2012/02/05/branch -每功能/ Or even just "one branch per developer + master ". 甚至只是“每个开发人员+ master人员一个分支”。
  • This transfers the problem from your un-history-fied local working directory to the git commit tree. 这会将问题从您未进行历史记录的本地工作目录转移到git commit树。 You now just have to find a way (with one of the workflows) to get out of the habbit of just manually modifying files all over the place directly in the live working directory. 现在,您只需要找到一种方法(使用一种工作流程)即可摆脱直接在实时工作目录中各处手动修改文件的习惯。

But it would really be wise to take the effort to get rid of the shared working directory on your development environment, and try hard to give each developer his own. 但是,尽力摆脱开发环境上的共享工作目录,并尽力为每个开发人员提供自己的目录确实是明智的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM