我使用此处的说明设置了一个 git 存储库:https://git.help.collab.net/entries/22564277-Migration-from-Perforce-to-GIT
我有一个主分支,在这里我从 perforce 获取最新的信息,并将我的更改提交给 perforce。我还有一个开发分支,用于我的工作,有时我会有一个功能分支(从开发分支出来)。
我一直在努力找出正确的工作流程,这就是我现在所处的位置 - 如果有更好的方法,请纠正我。
1) git checkout 大师
2) git p4 rebase(从 perforce 获取最新版本,我应该改用“git p4 sync”吗?)
3) git checkout 开发
3)git merge master(更新开发到最新)
4) git commit..(完成我所有的工作和提交)
5) git checkout master (准备 merge 开发到分支
6) git p4 sync(从 perforce pull 最新的)
7) git merge 开发
8) 解决任何冲突
9) git p4 rebase(从 perforce 中 pull 出最新的然后 rebase 我提交的更改)
10) git p4 提交
“git p4 rebase”应该只用在“git p4 commit”之前吗? 另外对于我的模型/工作流程来说, merge 比 rebase 更好吗?
最佳答案
来自 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 在堆栈顶部创建了一个额外的提交用于 merge 。这不是我们想要在远程非 git 存储库中显示的内容。所以我们用“git rebase” merge 代码。
关于git - 什么是正确的 Git p4 工作流程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21770502/