Is it possible to take the following setup and effectively split a branch into two branches based at a commit history?
eg: start with the following branch and commit history:
branch 1
git log:
commit 1
commit 2
commit 3
commit 4
Create branch 2 at commit 3's id and alter things to the following:
branch 1
git log:
commit 1
commit 2
branch 2
git log:
commit 1
commit 2
commit 3
commit 4
Use case: I started a new feature on an existing branch not yet in master and committed a bunch of work to that branch. I want to branch off of the last commit before my work and take my work with me and leave that branch clean of all my work.
You can do a git checkout some_commit_sha to go to a specific commit, and git checkout -b some_branch_name to create a branch from a commit and go to that branch.
Putting the two of those together, you can do git checkout -b some_branch commit_2_sha
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