gitatlassian-sourcetreegit-flowsourcetreegitblit

Pushing my Develop branch into Master does nothing (using Sourcetree)


I have a repository on a gitblit server where I executed git flow, having a Develop and Master branch.

I have made a lot of commits on Develop, and now I have a stable version, and would like to push my changes to Master. Using Sourcetree, pushing to Master, does not update Master at all. I had to manually open the console and use:

"git push origin HEAD:develop"

in order to have my Master branch updated. What am I missing? I have had a push from Develop before that updated my Master branch, but now only a manual push works.

Couple of weeks ago, I had Master on my original commit and my Develop about 15 commits ahead. I pushed from Develop to Master using Sourcetree, and everything went OK. I had Master updated on the newest version. Now, it does not work at all.

Thank you in advance.


Solution

  • Assuming you want to strictly follow git flow, to get commits that you have done into the develop branch onto the master branch, you should really go through a release branch. Within SourceTree, this can easily be achieved using the Git Flow button in the top right hand corner.

    enter image description here

    When you are ready to create a release, simply click the Git Flow button, and select the option that you want to do:

    enter image description here

    In your case, you want to create a New Release. That will create a new release branch, based off the current develop branch. On that branch, then finalize the release, for example, update any version numbers, etc. When you are ready, click the Git Flow button again, and select Finish Release. That will then merge the release branch into both the master branch and the develop branch.

    You can use the same process for hotfixes and features, and SourceTree "knows" which base branch to use, based on what you are trying to do.

    NOTE: If you have not initialized Git Flow on the repository, the first time you click the Git Flow button you will be asked to provide details about the structure of your repository. Typically, you can accept the defaults.

    The SourceTree Git Flow implementation is based on the Git Flow Branching Model which I would encourage you to take a look at, and also you can find some more information about their specific implementation here.