用于在GitFlow中剪切释放分支的实际命令

时间:2017-12-16 03:51:19

标签: git github git-flow

git的新手并尝试学习GitFlow。使用GitFlow,您经常会从develop分支中删除一个发布分支,以便您可以隔离新更改的子集并将它们部署到某个staging / nonprod环境中。但是,我无处可以找到有关切割这些版本分支的正确程序(命令方式)的可靠文档。是吗:

git checkout develop
git pull
git checkout -b release/1.1.3
git add .
git commit -m "Cutting release branch for v1.1.3."
git push

或者是:

git checkout develop
git pull
git checkout -b release/1.1.3
git push origin release/1.1.3

还是别的什么? 为什么?!

1 个答案:

答案 0 :(得分:2)

如果你跑:

git checkout -b release/1.1.3
git push

您可能会收到错误:

fatal: The current branch release/1.1.3 has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin release/1.1.3

因为您已在本地创建了新分支,所以在您告诉它应该跟踪的内容之前,它没有关联的上游跟踪分支。因此,您需要明确指出要推送它的位置,如:

git push origin release/1.1.3