开发者

git-flow: how to checkout release branch from origin?

What is the perferred workflow to pull a published release branch from the central repo using 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?

  • create the branch herself locally through git flow release start 1.0 and then git pull?
  • create a tracking branch locally through git with git checkou开发者_如何学编程t -b release/1.0 origin/release/1.0 and continue from there (does git flow work on the branch this way?)


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.

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 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 1.0

or

git flow feature track my-feature-branch

Here's the code excerpt from the gitflow source for the release "track" command:

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
}

Helpful git flow command line arguments


Once git flow release publish is done, you can do the following:

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”
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜