I'd like to create local branch based on other branch. For example I type:
git checkout -b feature1 release1.1.3
After that I get:
fatal: git checkout: updating paths is incompatible with switching branches.
What is the problem with this ?
Git provides us the capability to create a branch from another existing branch. Also, we can merge the branches using Git commands.
To make a merge, you check out some branch ( A in these cases) and then run git merge and give it at least one argument, typically another branch name like B . The merge command starts by turning the name into a commit ID. A branch name turns into the ID of the tip-most commit on the branch.
git branch <new-branch-name> <existing-branch-name>
To create a branch based on another branch, the simplest way is to first checkout the base branch, then create a new branch from there. If I understand your question right, that's exactly what you want to do.
Now, seeing as you are using the -b
flag in your branching, you may have working changes that you want to keep. If that's the case, you should push them onto the stash, check out the base branch, create the new branch, and pop the stash.
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