java - Undo bad merge already pushed to origin -
here situation :
i have develop branche , feature branche, when finishing feature want merge develop. conflicts arise so, first pull develop feature resolve commit modifications :
i commit file conflict resolved , forget rest. when merge feature develop rollback lots of commits...
origin develop> ----o-c-c-c-o-------m------ \ \ / local feature> f-------m-r-o
the commits 'c' merge feature when merging again develop forgot them.
how can solve ?
edit :
i'm not experimented git i'm asking have answer more specific problem everage git reset response
you have made bad merge.
origin develop> ----o1-c1-c2-c3-o2---------m2------ \ \ / local feature> f1----------m1-r1-o3
you mistake in commit m1
, changes propagated further down chain.
rewriting history
the cleanest solution problem rewriting history is still flowing correctly. however, breaks history every, need reset branch new head, recommended if seen mistake before pushed.
the fix redoing merge, redoing final merge master.
on branch: feature
:git reset --hard f1
we going state of branch @ commit
f1
on branch: feature
:git merge o2
redo our merge, making sure aren't discarding our index time
on branch: feature
:git cherry-pick r1
include changes introduced in commit
r1
on branch: feature
:git cherry-pick o3
include changes introduced in commit
o3
on branch: feature
:git push -f
force push our fixed feature branch
on branch: feature
:git checkout develop
switch develop, can fix it
on branch: develop
:git reset --hard o2
we going state of branch @ commit
o2
on branch: develop
:git merge feature
redo feature master branch merge, fixes whole chain.
on branch: develop
:git push -f
force push our fixed develop branch.
Comments
Post a Comment