Answer the question
In order to leave comments, you need to log in
How to split branches?
For example, I did a task in the feature-10 branch.
I sent a pull request to dev, but the pull is not approved yet.
I started a new task, made a feature-11 branch, but I want the changes in the feature-10 branch to be already present in feature-11.
And when I make a pull request from feature-11 to dev, then there will be feature-10 and feature-11 changes, but I want there to be changes separately for feature-10 and for feature-11
Answer the question
In order to leave comments, you need to log in
Look at the commit that has the desired changes from feature-10
Do a git cherry-pick <commit hash>
Before cherrypicking - there should be no active changes, if you already did something, then do "git add ." -> "git stash", then cherrypick, then git stash pop
Before you merge a feature-11 branch, you might be asked to delete the cherrypicked commit. It can be easily removed with git rebase -i
You can simply pull your branch away from feature-10 and if its pull request is closed by the time you're done with feature-11, the feature-11 pull request will only contain those commits that are related to feature-11
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question