Git Flow doesn't push after merge causing pull requests to close
Our flow requires us to open a pull request for each branch we merge to develop or master. Git flow doesn't push after merging which causes the pull request to be closed instead of being marked as merged. http://stackoverflow.com/questions/24418711/git-flow-github-pull-request-isnt-working-as-expected is a good explanation of what's going on.
there is a way to get around this for now
//use the -k flag to keep the feature branch
git flow feature finish test -k
//after all the merging is done, the PR should be marked as 'merged', so you can delete the remote branch
git flow feature delete test -r
but i agree with you it'd be nice have git flow merge, then delete remote branch automatically
Thanks for the workaround.
I agree that the default behaviour for this is unexpected, and possibly even dangerous. Pull requests being marked as closed instead of merged is one thing, but I don't want my remote feature branches deleted before the merge has been pushed to develop.
What if there's a conflict when I try to push develop? I've got to make sure I don't accidently lose those commits from the feature branch because my repository may now be the only one that contains them.
i just noticed the same thing. I think that the default should be to persist remotes. It's too dangerous the way it is.
You can set the flags to be default. So if you always want to keep feature, hot fix, bug fix, release branches you can set these flags.
I'd rather have the branches deleted after Github has marked them as merged.
Could this be a single option, so that it runs something like the below when finishing a feature? Or do you have a better solution? It would be great to use git flow feature finish, but currently we're doing our merging on GitHub for the aforementioned reasons.
git flow feature finish test -k
git push # Assuming this is needed
git flow feature delete test -r
The current behavior also breaks integrations with things like JIRA: to JIRA (and perhaps other similar tools) the PR being closed is a "rejection" from a workflow perspective.
@mgk indeed! Nothing new in this case ?
It looks like #330 will resolve this issue...
I've tested it locally, and as long as 'gitflow.feature.finish.push = true', it all works as I'd expect :D
@fatmcgav That PR is not still merged. How to install it?
@alex-shamshurin I just manually applied the patch to my local git-flow file...
I wonder to where I should apply the patch... https://github.com/nvie/gitflow and this gitflow-avh what is the difference?
@alex-shamshurin the nvie repo is outdated and probably no longer maintained, avh is the up to date project.
@edrpls So where is it?
@alex-shamshurin THIS is the gitflow-avh repo. To know what version you have installed, run: git flow version, if it doesn't include the avh suffix then you are on the old nvie version.
Ok, I have installed this one. BTW, what error line 81: [: -eq: unary operator expected is about?
Sounds like a warning.
How to name your supporting branch prefixes?
Feature branches? [feature/]
/usr/local/bin/gitflow-common: line 81: [: -eq: unary operator expected
Bugfix branches? [bugfix/]
/usr/local/bin/gitflow-common: line 81: [: -eq: unary operator expected
Release branches? [release/]
/usr/local/bin/gitflow-common: line 81: [: -eq: unary operator expected
Hotfix branches? [hotfix/]
/usr/local/bin/gitflow-common: line 81: [: -eq: unary operator expected
Support branches? [support/]
/usr/local/bin/gitflow-common: line 81: [: -eq: unary operator expected
I've installed the latest git for windows, git flow version 1.12.0 AVH edition.
git flow feature finish still appears to result in "closed" pr's.
Is there a config file I need to amend or something?
This may help others that get caught out - it's necessary to opt in to this feature, via configuration:
git config --global gitflow.feature.finish.push yes
git config --global gitflow.bugfix.finish.push yes
git config --global gitflow.hotfix.finish.push yes
Failing that, you can opt in via using an additional arg when finishing a feature:
git flow finish -p
As described on comment here
Failing that, you can opt in via using an additional arg when finishing a feature:
git flow finish -p
The problem seems to be that the target branch, e. g. develop, isn't pushed after merging. This is fixed by git config --global gitflow.feature.finish.push yes.
How would git flow finish -p, "preserve merges while rebasing", help in this case? I've tried it out but it seemed to fail still.