git-flow:如何从原点结帐发布分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5837921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git-flow: how to checkout release branch from origin?
提问by ChrisR
What is the perferred workflow to pull a published release branch from the central repo using git-flow?
使用git-flow从中央存储库中提取已发布的发布分支的首选工作流程是什么?
eg:
Mike made a release branch, he published it through "git flow release publish 1.0"
Jane would like to work on that release branch too, how does she pull it from the central repo to continue working with git flow on that particular branch?
例如:
Mike 创建了一个发布分支,他通过“git flow release publish 1.0”发布它
Jane 也想在该发布分支上工作,她如何从中央存储库中提取它以继续在该特定分支上使用 git flow?
- create the branch herself locally through
git flow release start 1.0
and thengit pull
? - create a tracking branch locally through git with
git checkout -b release/1.0 origin/release/1.0
and continue from there (does git flow work on the branch this way?)
- 通过
git flow release start 1.0
然后自己在本地创建分支git pull
? - 通过 git with 在本地创建一个跟踪分支
git checkout -b release/1.0 origin/release/1.0
并从那里继续(git flow 是否以这种方式在分支上工作?)
采纳答案by ChrisR
All that is needed is setting up a local tracking branch, no git-flow specific commands are needed. Git-flow apparently only cares about the name of the branch and if it is prefixed with the "release/" string.
所需要的只是设置一个本地跟踪分支,不需要特定于 git-flow 的命令。Git-flow 显然只关心分支的名称,以及它是否以“release/”字符串为前缀。
So setting up a local tracking branch like git branch --track release/1.5 origin/release/1.5
is all there is to it.
因此,设置一个本地跟踪分支就是git branch --track release/1.5 origin/release/1.5
它的全部内容。
回答by Noah Heldman
git flow release (and feature) have a "track" command to simplify what you're trying to do. To set up a local tracking branch for a branch that has already been published, and switch to it, just do this:
git flow release(和功能)有一个“track”命令来简化你想要做的事情。要为已经发布的分支设置本地跟踪分支并切换到它,只需执行以下操作:
git flow release track 1.0
or
或者
git flow feature track my-feature-branch
Here's the code excerpt from the gitflow source for the release "track" command:
以下是发布“track”命令的 gitflow 源代码摘录:
cmd_track() {
parse_args "$@"
require_version_arg
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git_do fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
echo "- A new remote tracking branch '$BRANCH' was created"
echo "- You are now on branch '$BRANCH'"
echo
}
回答by manojlds
Once git flow release publish
is done, you can do the following:
一旦git flow release publish
完成,你可以做到以下几点:
git fetch -q “origin” “release1.0”
git branch –no-track “release1.0” FETCH_HEAD
git checkout -q “release1.0”
And then you can start pulling:
然后你可以开始拉:
git pull “origin” “release1.0”