문제

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 checkout -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”
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top