我正在尝试开发一个 git flow 版本,该版本可用于一小群开发人员来管理我们的开发过程,大多数员工都是 git 和 bitbucket 的新手。我对两者都有更多的经验,但我绝不是专家。我们需要对上游开发的拉取请求进行一次提交,到目前为止我制定的流程如下:
假设来自上游的存储库的现有分支。另外,请注意,我知道其中一些命令可以组合使用,但我也在尝试先教授基础知识。这就是它的记录方式(或多或少,我在实际文档中更加冗长)。
# checkout
$ git checkout develop
# update
$ git pull --rebase upstream develop
# Create topic branch
$ git branch <topic branch name>
# Checkout topic branch
$ git checkout <topic branch name>
做工作
# Add changes to index
$ git add --all .
# Commit changes
$ git commit # and provide commit comment
为拉取请求做准备,这个分支被创建,所以我们可以在提交被压扁之前保留我们的提交,以防拉取请求被拒绝,或者出于任何原因。
# Branch the topic branch for a pull request
$ git branch <topic branch>-pr
# Checkout the topic branch
$ git checkout <topic branch>-pr
# Rebase to squash commits
$ git rebase -i # Rebase and provide a commit message
# for all of the commits that are squashed
# Something like the following is shown
pick 1fc6c95 do something
pick 6b2481b do something else
pick dd1475d changed some things
pick c619268 fixing typos
# Change the word pick to squash for all but the first line, for example:
pick 1fc6c95 do something
squash 6b2481b do something else
squash dd1475d changed some things
squash c619268 fixing typos
-> 在这一点上,我遇到了问题。我似乎无法完成一项承诺。这个分支中总是至少有两个提交,我已经看到使用 --root 的选项,但是当我这样做时,bitbucket 抱怨我的拉取请求分支和上游分支不相关,我无法发出拉取请求。
# Push branch to origin
$ git push origin <topic-branch>-pr
我觉得我非常接近有一个工作流程,所以任何帮助将不胜感激。