petervanderdoes / gitflow-avh

AVH Edition of the git extensions to provide high-level repository operations for Vincent Driessen's branching model
http://nvie.com/posts/a-successful-git-branching-model/
Other
5.42k stars 527 forks source link

Unable to close features if remote branch is missing #343

Open shalomb opened 7 years ago

shalomb commented 7 years ago

This relates to #264 and is perhaps the same issue.

$ git flow version
1.11.1-dev.21 (AVH Edition)

We use GitLab merge-requests (organizational requirement) where the remote branch is automatically closed when the merge request is completed.

If, however, you attempt to close a feature branch that has already been merged, you encounter this fatal error.

$ git flow feature finish 2-integrate-evm-ansible-bootstrap
fatal: Couldn't find remote ref feature/2-integrate-evm-ansible-bootstrap
Fatal: Could not fetch feature/2-integrate-evm-ansible-bootstrap from origin.
fatal: The remote end hung up unexpectedly

And the only way then is to delete the feature branch using git outside of the gitflow workflow. I suspect this would be the case for other types of branches too (hotfix, release, support, etc).

The issue is not present in nvie/gitflow.

jbinnography commented 7 years ago

You can also clean up the feature branch from within the gitflow workflow. This also cleans up the references in your git config.

git flow feature delete 2-integrate-evm-ansible-bootstrap

shalomb commented 7 years ago

Thanks @jbinnography - I hadn't realized feature delete existed as a feature :)

shalomb commented 7 years ago

Appears that the fix for our use-case is to set keepremote

git config gitflow.feature.finish.keepremote true

git flow then does not bomb out when doing a git flow feature finish blah, though a (useful) complaint is still present at the top of the message.


 f/add-wuff $ git flow feature finish add-wuff 
fatal: Couldn't find remote ref feature/add-wuff
Fatal: Could not fetch feature/add-wuff from origin.
Branches 'develop' and 'origin/develop' have diverged.
And local branch 'develop' is ahead of 'origin/develop'.
Switched to branch 'develop'
Your branch is ahead of 'origin/develop' by 1 commit.
  (use "git push" to publish your local commits)
fatal: The remote end hung up unexpectedly
Already up-to-date.
Deleted branch feature/add-wuff (was b4e8e1e).

Summary of actions:
- The feature branch 'feature/add-wuff' was merged into 'develop'
- Feature branch 'feature/add-wuff' has been locally deleted; it is still remotely available on 'origin'
- You are now on branch 'develop'
shalomb commented 7 years ago

As I believe I have a solution that works, this issue can be closed.

jkankiewicz commented 6 years ago

As I believe I have a solution that works, this issue can be closed.

@shalomb, Being that you are the ticket's reporter you should be able to close it yourself. :wink:

shalomb commented 6 years ago

I was under the impression this was resolved with

gitflow.feature.finish.keepremote true

but this is no longer the case

$  git config gitflow.feature.finish.keepremote true

$ git config gitflow.feature.finish.keepremote                                                                                                      
true

$ git flow feature finish                                                                                                               
fatal: Couldn't find remote ref feature/lnrg-link-resolution                                                                                                                                                           
Fatal: Could not fetch feature/lnrg-link-resolution from origin.                                                                                                                                                       
fatal: The remote end hung up unexpectedly

damn :|

For now, I'm having to do explicitly delete the feature locally.

$ git flow feature delete -f lnrg-link-resolution
dyegoalmeida commented 3 years ago

@shalomb hi friend, I was studying about git flow to possibly adopt in the company where I work, and I had the same problem, it tries to delete the remote branch but as it is already deleted it generates an error.

This issue is open, meaning nothing has been implemented to fix it yet, do you know why gitflow.feature.finish.keepremote true doesn't work?

Thanks.