git merge - Reverting a git pull that's already been pushed -


i'm not sure if duplicate or not it's kind of 1 off scenario:

i have "beta" branch, , started new "refactor" branch.

  1. i did bunch of code in "refactor" branch.
  2. i pulled latest changes beta refactor (git checkout refactor && git pull origin beta)
  3. my changes ready, checked out beta, , pulled changes refactor beta. (git checkout beta && git pull origin refactor)
  4. realized beta branch wasn't date, had git pull pull latest beta.
  5. now beta branch date, did git pull origin refactor ensure latest there (got auto-commit message refactor being merged beta).
  6. i pushed code :(

so i'm realizing 2 things did wrong:

  1. in step 3, should have done git pull first had latest changesets in beta
  2. in step 3 also, realized should have called git merge refactor instead of git pull origin refactor (don't ask me why did this, it's monday , wanted awesome refactor code beta start testing). realize if had done both of these things, none of later steps have been needed.

so question this: technically, code there , looks fine, network graph on github looks super funky, , don't have 1 clean "merge" commit can roll if merged branch needs reverted, instead beta has of individual commits refactor branch. there easy way can roll stupified merge , cleaner way?

i have tried doing git checkout beta && git reset --hard beta@{"1 hour ago"} , problem gets me outdated local version of beta instead of should have been latest version before issued merge when should have done git pull first. feel there should way git reset --hard origin/beta@{"1 hour ago"} reset remote beta branch @ 1 hour ago, , git merge refactor? able push changes , sure remote commits overwritten?

thanks in advance! i'm hesitant doing "git reset" refactor pretty major, , there lot of pending changes in beta didn't do, i'm more worried screwing reset , losing code worried having manually revert commits refactor branch pulled in.

did force push of beta branch?

if assume don't need synchronize 1 other developers, ok force push again. in case suggest:

  • do interactive rebase example last 10 commits "git rebase -i head~10"
  • remove commits got merge refactor branch , make sure beta clean , updated latest version of branch
  • force push it
  • go refactor branch , rebase on beta (git checkout refactor && git rebase beta)
  • go beta , merge refactor in without ff (git checkout beta && git merge --no-ff refactor)
  • this give nice , readable history graph

if can't force push, can complicate graph more. revert commit every commit in beta got pulled out of refactor. way beta branch clean , updated state. after that, repeat last 3 steps of upper recipe. nice graph out of that, history before 1 stays.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -