I've accidentally started working on a new feature in the middle of another. My repository simply looks like this:
A - B - C - D - E master
But I'm hoping to make it look like this:
A - B - D - E master
\
C new-feature
It seems like a simple question, but I haven't yet found an answer to it by searching. It seems like cherry-picking is close to what I want, and also maybe some rebasing, but I'm new to Git and some help would be appreciated.
You can move a commit to another branch using the Git command line.
First, to make the new branch:
git branch new-feature C
Next, to fix up master
git checkout master
git rebase -i B
When the editor comes up, delete C from the list. Save and exit.
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