git flow branches have diverged

GitGit Flow

Git Problem Overview


I'm using the git flow tools and I've gotten myself in a bit of problem. My git branches have diverged. I've read https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-how-to-undiverge-branches and have tried to follow the steps, both attempting to merge and to rebase my local repository.

	$  git flow feature finish showFindLogs
	Branches 'develop' and 'origin/develop' have diverged.
	And branch 'develop' may be fast-forwarded.
	$  git merge origin/develop
	Already up-to-date.
	$ git rebase origin/develop
	Current branch feature/showFindLogs is up to date.
	$ git status
	# On branch feature/showFindLogs
	nothing to commit (working directory clean)

How can I get out of this? I'm done with the git flow feature and I'd just like to get my changes up to the remote. Thanks!

Git Solutions


Solution 1 - Git

What happens here is that the remote has received updates, and git-flow requires that develop and origin/develop to be at the same commit before merging back the feature. This is to prevent bad conflicts when publishing the branch.

To solve this, you need to:

  1. sync your local develop with origin: checkout develop, and pull from origin to develop (git checkout develop && git pull origin)

  2. rebase your feature on develop with git flow feature rebase showFindLogs. You may have conflicts here if you're unlucky

  3. check that it doesn't break anything

  4. git flow feature finish showFindLogs

Solution 2 - Git

Make sure your develop branch is not behind origin, maybe you need to perform

git checkout develop

git pull

git checkout release/x.x.x

And continue the release process

Solution 3 - Git

All i had to do was:

  1. git checkout develop
  2. git pull origin develop
  3. git checkout feature/your_feature_name
  4. git flow finish

Solution 4 - Git

you might also want to ((as long it is not officially supported) patch and) use my

git-flow feature finish -p option

https://github.com/nvie/gitflow/pull/253

Solution 5 - Git

You can fetch from $ORIGIN before finish feature with this command:

git flow feature finish -F <name>

(docs)

Solution 6 - Git

For whoever googling this error, and using Hub-Flow - just do:

git hf update

Solution 7 - Git

For solve that problem you can use my implementation of git flow, based on @childno͡.de solution.

git flow feature/hotfix/release/bugfix  -e finish <name>

To install git flow execute in console:

git clone https://github.com/wyhasany/gitflow-avh/;cd gitflow-avh/;git checkout feature/force_merge;git pull;sudo make install

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPaul CezanneView Question on Stackoverflow
Solution 1 - GitCharlesBView Answer on Stackoverflow
Solution 2 - GitBruno PeresView Answer on Stackoverflow
Solution 3 - GitDavid MacharaView Answer on Stackoverflow
Solution 4 - Gitchildno͡.deView Answer on Stackoverflow
Solution 5 - GitManoloView Answer on Stackoverflow
Solution 6 - GitShohamView Answer on Stackoverflow
Solution 7 - GitMichał RowickiView Answer on Stackoverflow