Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Git Flow doesn't push after merge causing pull requests to close #201

Open
thedrow opened this issue May 6, 2015 · 20 comments
Open

Git Flow doesn't push after merge causing pull requests to close #201

thedrow opened this issue May 6, 2015 · 20 comments

Comments

@thedrow
Copy link

thedrow commented May 6, 2015

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.

@gmedina
Copy link

gmedina commented May 6, 2015

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

@thedrow
Copy link
Author

thedrow commented May 7, 2015

Thanks for the workaround.

@buckley
Copy link

buckley commented Jul 1, 2015

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.

@esetnik
Copy link

esetnik commented Mar 13, 2016

i just noticed the same thing. I think that the default should be to persist remotes. It's too dangerous the way it is.

@petervanderdoes
Copy link
Owner

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.

@thedrow
Copy link
Author

thedrow commented Mar 16, 2016

I'd rather have the branches deleted after Github has marked them as merged.

@mrmckeb
Copy link

mrmckeb commented Aug 21, 2016

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

@mgk
Copy link

mgk commented Oct 25, 2016

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.

@GrzegorzP
Copy link

@mgk indeed!
Nothing new in this case ?

@fatmcgav
Copy link

fatmcgav commented Dec 1, 2017

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

@alex-shamshurin
Copy link

@fatmcgav That PR is not still merged. How to install it?

@fatmcgav
Copy link

@alex-shamshurin I just manually applied the patch to my local git-flow file...

@alex-shamshurin
Copy link

I wonder to where I should apply the patch... https://github.com/nvie/gitflow and this gitflow-avh what is the difference?

@edrpls
Copy link

edrpls commented Aug 29, 2018

@alex-shamshurin the nvie repo is outdated and probably no longer maintained, avh is the up to date project.

@alex-shamshurin
Copy link

@edrpls So where is it?

@edrpls
Copy link

edrpls commented Aug 29, 2018

@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.

@alex-shamshurin
Copy link

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

@dazinator
Copy link

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?

@dazinator
Copy link

dazinator commented Jul 3, 2019

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

@alexanderdavide
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests