1

Completely messed up

I created remote branch feature/id99 from master. Then committed local changes and pushed to feature/id99

I was supposed to create branch from "QA" branch.

Because I branched from master, some of the code that was in master (and not in QA) is now included in my branch when I pull request to qa :-(.

How do I 1) keep the same branch "feature/id99", 2) "re-branch" from QA, 3) commit my changes into "feature/id99"?

Since no changes have been done to QA since I've been working on feature/id99, the objective should be when I pull request to QA, only my changes in "feature/id99" should appear in the request

Thanks

user20719
  • 209
  • 1
  • 13

1 Answers1

2

That can be easily fixed:

git rebase --onto=QA-branch master feature/id99

Asking git to put id99 on top of qa branch not carrying over revisions from master. Then it's about using git push --force into your remote branch because you are rewriting its history.

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • Thanks @eftshift0! Saved my a#$! Did the rebase and now my branch is pointing correctly from the intended branch! Luckily, I'm getting slightly better a git; rebase is cool though I understand need to be extra careful when using it – user20719 May 09 '20 at 19:58
  • Good for you! Once you master rebase and cherry-pick, sky is the limit! – eftshift0 May 09 '20 at 20:21
  • Glad I have found this. You saved me too. – Piotr Sobuś Oct 05 '21 at 12:17