Add "-f,--force" flag to "git flow {bugfix,feature,hotfix} publish" command
The git flow {bugfix,feature,hotfix} rebase command enables one to rebase a branch on its basis branch but if the basis branch actually contains new commits and the branch has been previously published then the subsequent attempt to publish its newly-rebased form will inevitably fail e.g.
$ git flow rebase
Will try to rebase 'example-issue' which is based on 'develop'...
Successfully rebased and updated refs/heads/feature/example-issue.
$ git flow publish
To http://github.example.com/example-organization/example-repository.git
! [rejected] feature/example-issue -> feature/example-issue (non-fast-forward)
error: failed to push some refs to 'http://github.example.com/example-organization/example-repository.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Already on 'feature/example-issue'
Your branch and 'origin/feature/example-issue' have diverged,
and have 7 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
Summary of actions:
- The remote branch 'feature/example-issue' was created or updated
- The local branch 'feature/example-issue' was configured to track the remote branch
- You are now on branch 'feature/example-issue'
It would be convenient if one could resolve this problem simply by appending a "-f" or "--force" flag to a re-invocation of the same command (e.g. git flow rebase --force) instead of having to recall what the branch's current basis branch is in order to push it manually (e.g. git push origin feature/example-issue --force).
Seconding this. Running into this when working on multiple features at once. Our workflow is as following: feature publish -> MR to staging branch. Other feature rebases then fail to push to origin due to divergence.
Having a force push on rebase integrated behind a configuration setting would ease our workflow.