I have commit X and 2 commits after it. I should move only X to new branch. How can I do this?
(And my repo is in remote repo also, I don't think exactly what is it, but I won't get "detached head")
Thanks a lot
If commit X is the only commit you want to port to the new branch and the branch is new, simply start the new branch from that commit.
$ git branch newbranch COMMIT_HASH
If you want to move commit X to an existing branch and commit X doesn't necessary fit the branch history, then you can cherry-pick the commit
$ git cherry-pick COMMIT_HASH
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