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

标签 git merge perforce git-rebase

我使用此处的说明设置了一个 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/

相关文章:

java - 如何使用不同的java包名称创建perforce分支?

git - showcompare 命令的 TortoiseGitProc 命令行参数

mysql - 我需要一个 Git 钩子(Hook)来同步 MySql 模式

visual-studio - 断开 TFS 中各个文件的分支链接

python-3.x - Pandas系列垂直合并

perforce - 如何更改 p4 信息中的默认服务器值

git - 从不同的 repo 中挑选提交

git - 通过 Groovy 访问 Jenkins 凭据存储

javascript - Dgrid - 如何将单元格合并成一行

perforce - 如何列出由强制更改列表更改的所有文件