Is git-flow broken in Sourcetree 2.7.1?
Asked by Richard Senior:

I have 2.7.1 (156) with embedded git-flow, running on latest Mac OS.

The normal git-flow process when finishing a release is:

1. Merge release branch into master
2. Tag master with the release version
3. Merge release branch into develop
4. Delete release branch

It looks to me like git-flow is only doing steps 1 \& 2. No error dialogs.

To reproduce: make a test project initialized with git-flow, add a couple of commits on develop, start a new release, make a commit in the release branch and try and finish the release. I end up sat on master, release branch still there and develop missing the commit from the release branch.

I've used git-flow a lot and never had this problem. Can anyone confirm the same issue?

EDIT (15-Feb-2018): I installed git-flow using Homebrew and tried the same test from the command line with git-flow. It works fine. So I switched Sourcetree to system git-flow and tried again. I get "

flags:WARN getopt: illegal option -- f

-- /var/folders/h8/n_m5b8zs26bdcng40f1p2xp80000gn/T/SourceTreeTemp.1BO8Ra 1.3

flags:FATAL unable to parse provided options with getopt."

I'll raise a ticket.


Answers:
author: Manju
body: You need getopt to make this work. You can follow the Post Installation setup from [Installing-on-Mac-OS-X](https://github.com/petervanderdoes/gitflow-avh/wiki/Installing-on-Mac-OS-X#post-installation-setup-1) to get this working. We are trying to get this fixed for the next release.

comments: author: Richard Senior
body: Thanks Manjunath. I uninstalled git-flow using Homebrew and replaced it with git-flow-avh. With Sourcetree set to use system git-flow, release branches work correctly again. I didn't have to install gnu-getopt, Homebrew pulled gnu-getopt in as a dependency.

With embedded git-flow, release branches didn't work initially. I had to follow this step in the post-installation instructions for git-flow-avh:
> Create a `~/.gitflow_export` with the content `export FLAGS_GETOPT_CMD="$(brew --prefix gnu-getopt)/bin/getopt"`.

Note that I had to change 'brew' to '/usr/local/bin/brew'.

With that config, Sourcetree 2.7.1 (159) is able to finish release branches again using embedded git-flow. I suspect I could have just installed gnu-getopt with Homebrew and done the config as above but I've decided I like having the command line version of git-flow around.


author: zachgarcia
body: is there any update on this? i'm using version 3.1.2. I seem to be able to create it from the latest development branch just fine however when choosing a specific commit / working revision it does not which it did previously.


author: Richard Senior
body: I'm getting an error trying to finish a hotfix branch using gitflow since updating to 2.7.1 as well.
> flags:ERROR short flag required for (showcommands) on this platform
>
> flags:ERROR short flag required for (keepremote) on this platform
>
> flags:ERROR short flag required for (keeplocal) on this platform
>
> flags:ERROR short flag required for (squash-info) on this platform
>
> /Applications/SourceTree.app/Contents/Resources/git_local/gitflow/gitflow-common: line 81: \[: -eq: unary operator expected
>
> /Applications/SourceTree.app/Contents/Resources/git_local/gitflow/gitflow-common: line 81: \[: -eq: unary operator expected

It doesn't look like any action is applied.

I'm going to see if I can downgrade to the previous version of SourceTree.

EDIT: After downgrading to 2.6.3 I no longer get any errors.

comments: author: Richard Senior
body: I've done some more testing with members of a team I'm working with. Some had the problem and others not. Our best guess is that the issue with finishing release branches is a regression in 2.7.1.

We found 2.6.x versions to be OK. The latest 2.7 version that seemed to work was 2.7 (152).

Of course, this doesn't explain why Manjunath is OK with 2.7.1 and I am not.


author: Manju
body: I can get some more folks try this internally and see where the issue is. FWIW, versions 2.7 and above have git-flow avh integrated.


author: Indexis - Contato
body: Me and a coworker have the same problem, when closing features or relases


author: Manju
body: You need getopt to make this work. You can follow the Post Installation setup from [Installing-on-Mac-OS-X](https://github.com/petervanderdoes/gitflow-avh/wiki/Installing-on-Mac-OS-X#post-installation-setup-1) to get this working. We are trying to get this fixed for the next release.


author: Indexis - Contato
body: Going back to 2.7 solved for now.


author: Aden Narkowicz
body: Hi [@Manju](/t5/user/viewprofilepage/user-id/222564)

I'm running SourceTree v2.7.1 (159) on Sierra 10.12.6 (16G1114) and am seeing this problem.

I have the latest \`git-flow-avh\` installed via brew and switching from the embedded \`git-flow\` to that binary fixes the problem.

I presume you're not suggesting that we need to manually install \`getopt\` to use the embedded \`git-flow\` bundled with SourceTree?


author: Richard Senior
body: If you installed git-flow-avh via Homebrew, it should have installed gnu-getopt. You can confirm that by running \`brew list\` in Terminal.

To make embedded git-flow work, you will need a \`.gitflow_export\` file in your home directory with this line in it:

```
FLAGS_GETOPT_CMD="$(/usr/local/bin/brew --prefix gnu-getopt)/bin/getopt"
```

I'm assuming all of this is just a workaround and that we won't need gnu-getopt once the issue is fixed, but Manjunath is better placed to comment on that.


author: Stenio Anibal
body: This works beautiful for me but, prevision to next release fixing this bug?


author: Andrew Law
body: Version 2.7.1 (159) on OSX 10.13.3 still has the problem. I just had to downgrade from Time Machine backup.


author: Frank Lehmann
body: I have the same issue after updating to 2.7.1 today.

Finishing features and releases won't merge and delete the branch correctly :/


author: Richard Senior
body: Thanks for your reply. I've updated to 2.7.1 (157) and tried again but I still have the same problem. I've tried it on another Mac and it's the same there too.

I've tried various combinations of embedded and system git and git-flow. If I use system git-flow and don't tag the commit to master, it works as expected, but that's not really a solution.


author: grit_mike
body: I had to install Sourcetree 2.7.4 on an older Mac running Sierra and ran in to this issue. I fixed it by renaming 'Sourcetree 2.app' to 'Sourcetree.app'.


author: lasmit
body: I am also unable to close feature in gitflow. Happy to provide more info if it helps debug the issue.

comments: author: lasmit
body: In trying to move this forward I tried a free trial of Tower.

Tower showed I had a file in a repo which needed committing. I committed it in Tower and then did the gitflow in SourceTree and it worked.

Interestingly, after fixing the issue, in SourceTree commit history I see the commit and the file that it said should be updated. In Tower I see the commit, but it says nothing changed in that commit.

Again, happy to provide more info if I can


author: victorchat
body: I followed Manjunath's advice and it seems to be working fine now

comments: author: Andrew Law
body: But now you've had to install something else in order to get SourceTree to work. That's not sane in the long term


author: victorchat
body: I already had git-flow-avh installed in order to work with git-flow using the command line so it was not a big change for me.


author: Manju
body: We understand the frustration of not being able to get things done out of the box. Its on our priority list to get it fixed soon. Thanks for your patience and understanding in the meanwhile.


author: yuuki minohara
body: I had the same issue after updating, I solved this issue by downloading old version, here.

<https://www.sourcetreeapp.com/download-archives>

I hope solving this issue by next version.


author: dyeazel
body: I can't even authenticate after updating to 2.7.1

comments: author: Manju
body: Please describe your issue in detail to avail help. It would be very kind of you to move this to a new thread since this is specific to git-flow issues.

Thanks!


author: Virl
body: Same problem here.

comments: author: Manju
body: You need getopt to make this work. You can follow the Post Installation setup from [Installing-on-Mac-OS-X](https://github.com/petervanderdoes/gitflow-avh/wiki/Installing-on-Mac-OS-X#post-installation-setup-1) to get this working. We are trying to get this fixed for the next release.


author: julianmarquesgarcia
body: I have the same issue after updating.

I have changed the preferences to use system gitflow and it works


author: Manju
body: Hi [@Richard Senior](/t5/user/viewprofilepage/user-id/1187756)

I'm on the latest version of Sourcetree v2.7.1(157) and I don't see this issue. My release branch was merged both to master and develop and deleted after that. I've attached below screenshot that just shows the same. ![gitflow_demo.png](https://community.atlassian.com/t5/image/serverpage/image-id/15064iBAE0B9BF03FCA301/image-size/large?v=v2&px=999 "gitflow_demo.png")


Tags: git-flow