什么是正确的Git p4工作流程?

4
我使用这里的说明来设置了一个Git仓库:https://git.help.collab.net/entries/22564277-Migration-from-Perforce-to-GIT。我有一个主分支,用于从Perforce获取最新版本并将我的更改提交到Perforce。我还有一个开发分支,我在其中进行工作,有时会有一个功能分支(从开发中派生)。
我一直试图找出正确的工作流程,现在在这里,请纠正我,如果有更好的方法请告诉我。 1)git checkout master 2)git p4 rebase (从perforce获取最新版本,应该使用“git p4 sync”吗?) 3)git checkout development 3)git merge master(将开发更新为最新版本) 4)git commit …(完成所有工作和提交) 5)git checkout master(准备合并开发到分支) 6)git p4 sync(拉取Perforce最新版本) 7)git merge development 8)解决任何冲突 9)git p4 rebase (拉取最新的Perforce然后将我提交的更改放在它之上) 10)git p4 submit
“git p4 rebase”应该只在“git p4 commit”之前使用吗?对于我的模型/工作流程来说,合并比rebase更好吗?

我认为 #9 应该在 #6 之后,然后合并 dev 解决并提交。 - A_P
1个回答

2

来自 http://owenou.com/2011/03/23/git-up-perforce-with-git-p4.html:

命令

使用 git-p4 时需要记住以下四点:

Instead of using “git push” to push local commits to remote repository, use “git-p4 submit”
Instead of using “git fetch” to fetch changes from remote repository to local, use “git-p4 sync”
Instead of using “git pull” to fetch and merge changes from remote repository to local, use “git-p4 rebase”
Instead of using “git merge” to merge local branches, use “git rebase”

最后一个原因是,当你运行“git merge”时,Git会在堆栈顶部创建一个额外的提交来进行合并。这不是我们想要显示在远程非Git仓库中的内容。因此,我们使用“git rebase”合并代码。


至于最后一点,我不太了解p4,但是我和其他非git版本控制系统的交流经验表明,它们无法像git那样轻松地管理复杂的历史记录,因此您必须向它们提供线性序列。或者至少必须使用特殊工具/命令在中央存储库上执行合并操作。 - vonbrand

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接