I have the following Git commits tree:
R - A - B - C - D (master)
I would like:
R - A - B - D' (master)
\ - C (new-branch)
How could I do that (assuming it is even possible)?
I started using git cherry-pick but I didn’t manage to remove the commit from the master branch.
Thanks.
You cannot get exactly what you want since there will be differences in the commits, but the content of the files will be as you want if you do:
Note that you do not really need to cherry-pick to set new-branch, and you could just as easily do:
while you have new-branch checked out. This will actually give you R-A-B-C instead of R-A-B-C’. Note that the only difference between C and C’ is the commit time.
Once you do the reset, you may have a hard time locating the sha1 hashes of the various commits (they are available from the reflog), so you may want to put tags on everything before you begin, or store the history somewhere.