在使用git rebase或git合并时,是否有更好的实施策略来避免冲突?
目前,我正在从事一个针对GIT策略的项目:
- 我们有一个主分支(生产)(生产)
- ,只要我们需要一个新功能或修复,我们就有一个登台分支(登台服务器),
- 我们都会从Master和实现后创建功能分支拉的请求。经过批准和单位测试后,我们创建了另一个从功能分支到主的请求。
现在,我有一些疑问,尽管还没有遇到任何问题。如果有人将更改为主(通过拉动请求),我想使用“ git rebase”。如果我的功能分支尚未合并到分期或生产中,那么以下策略是好的。
- 首先,我将更改为主。
- 然后,我将“重新列入”主人分支。
- 然后,我将删除远程功能分支(因为目前我只是在研究它)
- 然后,按下新功能分支并创建拉动请求进行登台。
这是好吗? (问题1 )
现在,假设我的分支已经合并为分期。因此,在那种情况下,我应该合并而不是折叠? (问题2 )
注意:我不想在分期或主分支中更改任何以前的提交历史记录。但是,如果我只是在功能分支上工作,我可以更改历史记录。我认为这不会引起任何问题。
在问题2中,应该采取什么策略或步骤?
结论:我想知道,如果提出问题1中的上述策略是好的?我是否可以继续这样做,如果有更好的解决方案以避免冲突?
Currently I am working on a project with following strategy for Git:
- We have a master branch (production)
- We have a staging branch (staging server)
- Whenever we need a new feature or fix, we create feature branch from master and after implementation, create a Pull Request to Staging. After approval and unit test, we create another Pull Request from feature branch to Master.
Now, I'm having some doubts, though haven't faced any issues yet. If anyone push changes to Master (via Pull Request) and I want to use "git rebase". Is the following strategy good, if my feature branch is not yet merged to staging or production.
- First I will Pull changes to master.
- Then, I will "rebase" feature branch from master.
- Then, I will delete remote feature branch, (because currently I am only working on it)
- Then, Push the new feature branch and create a Pull Request to Staging.
Is this all right? (Question 1)
Now, let's assume, my branch is already merged to Staging. So in that case, I should merge instead of rebase? (Question 2)
Note: I don't want to change any previous commit history in Staging or Master Branch. But If I am only working on a feature branch, I can change history. I don't think that will cause any problem.
With the Question 2, What should be the strategy or steps to do so?
Conclusion: I want to know, If the above strategy as asked in Question 1 is good? Shall I continue with that and If there is any better solution to avoid conflict?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论