Reputation: 2115
I should've done git checkout -b "test"
from master
, but I accidentally checked out from branch1
, so now all of the non-working code from branch1
is clustered into my test
branch.
I think the correct command is git rebase master
, which updates my current branch's parent branch to be master
, but it doesn't seem to be working. Is this the right command?
Upvotes: 3
Views: 43
Reputation: 2036
I am a little confused as to the structure of the your repository before and after the creation of the "test" branch. I am assuming that "branch1" is branching off of master, and now "test" is sitting on top of "branch1" like this:
master branch1 test, HEAD
- - * - - * - - * - - * - - *
a b c d e
If this is the case then you can run git rebase --onto master branch1 test
and that will change your repository to:
master branch1
- - * - - * - - *
a\ b c
\ test
- - - - - - - * - - *
d' e'
If that is not the original situation, then I am confused.
Upvotes: 2