简体   繁体   English

使用远程服务器处理部分源代码树时的Git工作流程

[英]Git workflow when working on part of a source tree with a remote server

I have a project which contains different components that everyone works on. 我有一个项目,其中包含每个人都在从事的不同组件。 We have a server-side component, and N amount of client components that interact with the server. 我们有一个服务器端组件,和N个与服务器交互的客户端组件。 I myself am responsible for one of the client components. 我自己负责客户端组件之一。

I'm at a point where I'd like to branch off to develop new features for the client. 我现在想分支为客户开发新功能。 The problem here is that while I'm updating the client, I'd like to do the following: 这里的问题是,当我更新客户端时,我想执行以下操作:

a) Make sure all server-side updates that are being made by colleagues make their way to my experimental branch. a)确保同事所做的所有服务器端更新都可以进入我的实验分支。 b) Push my experimental branch to a shared repo so folks can see the work I've been doing. b)将我的实验分支推送到共享存储库,以便人们可以看到我正在做的工作。 c) Merge back into master branch when features are done. c)完成功能后,合并回master分支。

What's the best strategy for this particular workflow when working with a shared repo? 使用共享存储库时,此特定工作流程的最佳策略是什么?

Thanks for your solution(s). 感谢您的解决方案。

The standard workflow works like that: 标准工作流程如下:

  1. git clone to create your local repository. git clone创建您的本地存储库。
  2. create a tracking branch of origin/master . 创建origin/master的跟踪分支。
  3. create your branch off of your local tracking branch. 从本地跟踪分支创建分支。

Now to fulfill: 现在实现:

  1. condition a) you can pull from the origin repository. 条件a)您可以从原始存储库中提取。 This will make a changes to your local tracking branch. 这将对您的本地跟踪分支进行更改。 If it is ok. 如果可以的话。 Do git merge or git rebase to import the changes of other people to your branch. 执行git mergegit rebase将其他人的更改导入分支。
  2. condition b) use git push to send your branch on the shared repository. 条件b)使用git push在共享存储库上发送分支。
  3. condition c) when you are done with your branch merge it to the master branch and push it to the shared repository. 条件c)完成分支后,将其合并到master分支并将其推送到共享存储库。

This is the simplest way of doing things. 这是最简单的做事方式。

You may also use private/public repository for everyone. 您也可以为所有人使用私有/公共存储库。 Look at some workflow proposal for Git. 查看有关Git的一些工作流程建议。 In this case, you get rid of the pushing and only use pull/merge . 在这种情况下,您无需使用推入功能,而只能使用pull/merge

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

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