【发布时间】:2023-11-26 03:19:02
【问题描述】:
在一个大型团队项目中工作,这是我们的工作流程:
// create branch
git checkout -b mybranch
(do work)
// commit to branch locally
git commit -a
// push to remote
git push origin mybranch
(repeat)
在我们的分支中完成工作后,我们将分支合并到 master:
// go to master
git checkout master
// update
git pull master
// merge our branch into master
git merge mybranch
(solve conflicts)
git push
现在我们只需重复上述步骤,几天的工作流程就很好了。现在突然间,每个人都在其他组成员分支和主控上获得非转发更新。例如有人 git 在 master 中拉入,然后合并但他们无法推送。它说非快进推动。这很奇怪,因为它说 master 完全是最新的。
下面是紧接着一个 git pull, git merge mybranch, git push:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:foo/project.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
然而 git pull 说我们是最新的。
所以问题是,对于 GIT 中的大型团队,预期的工作流程是什么?我们应该如何处理分支机制。
谢谢!
【问题讨论】:
标签: git github versioning