tpdi
tpdi

Reputation: 35141

git: merge back in what I merged out

So I merged a branch, "badBranch", into my develop branch, and discovered several commits after merging that it was buggy.

I did a revert: git revert -m 1 <commit hash of the merge>

Worked great. Time moved on, code was written, further changes were committed on develop.

Now, having more leisure, I want to merge badBranch back into develop (or develop into it) to see if I can fix it.

But develop thinks that badBranch is in its history (I think?), so when I checkout badBranch and merge develop into it, I just get the current state of develop.

How can I force an actually merge of devleop and badBranch?

Thanks.

Upvotes: 3

Views: 96

Answers (2)

kan
kan

Reputation: 28951

It is surprisingly straightforward - just revert the revert:

git revert <commit hash of your merge revert>

The howto link by Marco also offers the next solution: rebase the badBrahcn with -no-ff to recreate all commits (all the SHA IDs will be different) and merge it to the master.

Upvotes: 6

user874577
user874577

Reputation:

I don't know if this will work, but what if you checkouted badBranch and merged in develop and then checkouted develop and merged in badBranch?

Upvotes: 0

Related Questions