简体   繁体   中英

How I can restore merged deleted branches from merged PR's in github upon rollback so I can manually re-merge them?

In my project I

Once I rollback changes to master branch to a specific tag I follow the following procedure:

  1. I make a branch before_rollback that gets the changes from master:
     git checkout master # I'll need to use the before_rollback branch to make a diff for branches to re-merge git checkout -b before_rollback git checkout master
  2. Then I revert to the tag I want to and forcefully push it:
     git reset --hard ^tag_to_revert^ git push origin --force master

But before_rollback branch also contains some other changed comming from closed PR's with deleted branches from github. What I want to do is to re-open the branches and manually get the diff of the branched that need re-merge so I can re-merge them back.

In other words I want to somehow get a diff of the merged branches between master and before_rollback and re-open them, regardless if they have been deleted or not.

Is there a way to do this?

Here is a possible alternative workflow for this:

  1. Don't rewind main
  2. Starting from the latest, for all bad PRs create revere commits and merge these changes to main.
  3. Using a feature branch (or branches),
    • for each bad PR that was reverted,
    • starting from the oldest one,
    • create a reverse of the reverse (ie the original change)
    • and merge these to main ,
    • modifying each merge of to you liking.

No --force anywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM