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.

  1. on branch: feature: git reset --hard f1

    we going state of branch @ commit f1

  2. on branch: feature: git merge o2

    redo our merge, making sure aren't discarding our index time

  3. on branch: feature: git cherry-pick r1

    include changes introduced in commit r1

  4. on branch: feature: git cherry-pick o3

    include changes introduced in commit o3

  5. on branch: feature: git push -f

    force push our fixed feature branch

  6. on branch: feature: git checkout develop

    switch develop, can fix it

  7. on branch: develop: git reset --hard o2

    we going state of branch @ commit o2

  8. on branch: develop: git merge feature

    redo feature master branch merge, fixes whole chain.

  9. on branch: develop: git push -f

    force push our fixed develop branch.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -