I usually use subversion, and am getting used to git.
I cloned a copy of a remote repository to my localhost, and then created a new branch, which we'll call "myNewBranch'. However, I created that branch off of master when it should have been a sub-branch of "DEVELOPMENT".
Here are the steps I took:
Here is what the hierarchy should look like:
Master ---> DEVELOPMENT ---> myNewBranch
Here is what it currently looks like: Master--->myNewBranch
How can I rectify this?
Simply rebase your new branch on top of development.
git checkout myNewBranch
git rebase development
I accepted Igal S.'s answer, however instead of rebase I used cherry-pick.
I had a single commit, and my commit was the very last one, so I checked out DEVELOPMENT into a new branch:
git checkout -b myNewBranch DEVELOPMENT
And then ran cherry-pick on my commit (had to get the hex checksum)
git cherry-pick <hex checksum>
And then reconciled conflicts.
After that, I commited changes from cherry pick, and then deleted my old branch on both local and master. I'm still new to git, so don't take my word on this as a solution, but if might be helpful if other people run into the same problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With