好的,我只想检查GIT设置的工作流程是否正确,并且在我开始正确使用它之前,我已经完全了解它.我正在使用此工作流程,本主题仅涉及从初始化和创建功能分支开始,然后,当我确信这一点时,我将为发布和修补程序创建一个新主题.希望这将对希望在类似工作流程中使用GIT的其他人有所帮助.
OK, I just want to check the workflow of my GIT setup is correct and I understand it fully before I begin to use it properly. I'm following this workflow and this topic is just going to start with the initialization and creating feature branches then when I'm confident with that I'll create a new topic for Releases and Hotfixes. Hopefully this will help other people to who are looking to use GIT in a similar workflow.
有3个开发人员,分别称为A,B和C,他们都将在其本地计算机上工作,我们有4个远程服务器-开发",登台",生产"和取消混淆"(作为集中式服务器) .开发人员A在其本地计算机上拥有文件目录.
There are 3 developers, let's call them A, B and C who will all work on their local machine, we have 4 remote servers - 'Development', 'Staging', 'Production' and Unfuddle (as the centralized server). Developer A has the directory of files on their local machine.
所以,我认为工作流程如下.
So, i'm thinking the workflow will be as follows.
首先,我需要在Unfuddle上创建存储库,然后在本地将文件推送到Unfuddle服务器.
Firstly, I need to create the repository on Unfuddle and locally then push my files to the Unfuddle server.
在Unfuddle中创建一个名为"website"的存储库,并将其缩写为"web"
Create a repository in Unfuddle called 'website' and give it the abbreviation 'web'
在开发",登台"和生产"服务器上创建SSH密钥对,并将其添加到Unfuddle帐户中.
Create an SSH Keypair on 'Development', 'Staging' and 'Production' servers and add them to Unfuddle account.
开发人员A在其文档根目录中初始化Git存储库:
Developer A initializes a Git repository in their document root:
git init
将Unfuddle存储库与开发人员A的本地存储库相关联,并将其指定为上游服务器:
Associate the Unfuddle repository with developer A's local one and designate it as an upstream server:
git remote add unfuddle git@subdomain.unfuddle:username/web.git
git config remote.unfuddle.push refs/heads/master:refs/heads/master
开发人员A将所有文件添加到索引
Developer A adds all files to index
git add *
开发人员A提交所有文件
Developer A commits all files
git commit -am 'initial commit'
开发人员A将本地提交的内容推送到Unfuddle Git存储库.
Developer A pushes locally made commits to Unfuddle Git repository.
git push unfuddle master
现在我应该在我的Unfuddle存储库中看到所有文件.开发人员B和C现在可以克隆存储库以获得网站文件的副本.
I should now see all of my files within my Unfuddle repository. Developers B and C may now clone the repository to get a copy of the website files.
`git clone git@subdomain.unfuddle:username/web.git`功能分支:
每个开发人员现在都可以使用以下工作流程开始创建功能分支:
Each developer can now begin creating feature branches using the following workflow:
好的,所以我不确定下一部分.我们已经将功能更改推送到集中式Unfuddle服务器,但是其他开发人员需要进行更改,因此他们是否需要创建'develop'分支然后执行git pull unfuddle develop?我读过fetch和merge比pull更好,是这种情况吗?如果是这样,是git fetch unfuddle develop然后是git merge develop吗?
OK so the next part I'm unsure of. We have pushed the feature changes to the centralized Unfuddle server, however the other developers need to get the changes, therefore would they need to create a 'develop' branch and then do git pull unfuddle develop? I've read a fetch and merge is better than pull, is this the case? If so, would it be git fetch unfuddle develop then git merge develop ?
推荐答案听起来很可靠.
关于pull与fetch,我认为,如果您确切了解拉动的作用(fetch/merge),则可以自由使用它.很多不熟悉git的新手都在不了解pull用途的情况下使用它,但似乎您已经掌握了它.我只是确保您的团队知道区别是什么.
With regards to pull vs fetch, I think that if you know exactly what a pull does (fetch/merge), you can use it freely. A lot of newcomers to git use pull without understanding what it does, but it seems like you grasp it. I'd just make sure your team knows what the difference is.
我唯一看不到的步骤是部署到Web服务器-这些服务器也应该在更新上执行fetch/merge或pull.您可能希望以手动进行此过程开始,并考虑在将来使其自动化.您应该可以使用git hooks来做到这一点(Unfuddle中应该支持它们).这些脚本将根据您正在运行的服务器类型而有所不同.
The only step I'm not seeing is the deployment to your webservers - those should be doing a fetch/merge or pull on updates as well. You may want to start off with this process being manual and consider automating it in the future. You should be able to do that with git hooks (they should be supported in Unfuddle). Those scripts will vary on the type of servers that you're running.
更多推荐
集中式GIT工作流程/部署
发布评论