Dan
Dan

Reputation: 902

git flow release start when origin/develop is ahead of my local develop branch

This happens to me from time to time; I want to create a release branch off of my develop branch, but I've already fetched the latest commits from origin (not merged the commits, just fetched them). My commit chain can look like this:

a--b--c(develop, HEAD)--d(origin/develop)

I can view the "d" commit made by another developer and know that I don't want to include it in the new release, so I keep my repo checked out at the "c" commit and try to create a release branch. What I want is:

a--b--c(develop)--d(origin/develop)
       \
        --e(release/1.1,HEAD)

But when I run git flow release start 1.1, it fails:

Branches 'develop' and 'origin/develop' have diverged.
Fatal: And branch 'develop' may be fast-forwarded.

As far as I can tell I can't force the git flow release start to create the release branch, or target which commit to use as the base for the release branch. What are my options here?

Thanks, Dan

Upvotes: 2

Views: 2115

Answers (1)

Gary Ewan Park
Gary Ewan Park

Reputation: 19001

According to the original article on Git Flow here:

https://nvie.com/posts/a-successful-git-branching-model/

Creating a release branch is as simple as:

git checkout -b release-1.2 develop

i.e. a simple branch from the current develop branch.

So while the git-flow extension might be doing some sense checking to ensure that the current head of your develop matches what is on your origin remote, there is nothing to stop you manually running the command, rather than using the git-flow extension.

You should be able to do something like:

git checkout -b release/1.1 <sha1-of-commit>

Where you are specifically stating the sha of the commit that you want to start the branch from.

This is covered in more detail in this SO question:

Branch from a previous commit using Git

Upvotes: 4

Related Questions