I did this completely on the command line, but I am going to insert screenshots from SourceTree to illustrate what is happening.
First get the first 7 or 8 digits of the commit identifier (50da9c3) from transaction C5 and add to your clipboard or textedit or something else - you'll need it later
To confirm, here is our initial state:
Here are the steps you need to complete so that you can:
Create a new branch without roots to start the construction, it completes the work with the named base.
git symbolic-ref HEAD refs/heads/base
Now delete all files and directories from git
git rm --cached -r .
Now that all untracked files remove them from the local working directory
git clean -d --force
Now create a commit without anything (this will be a commit on which everything will be built).
git commit --allow-empty -m'Initial Commit'
Your tree should look like this:
Now the cherry selects c5 commit (what you had on the clipboard)
git cherry-pick 50da9c3
Now reinstall the main branch to the base branch
git rebase --onto base --root master
Now you can delete the base and c4-c5 branches
git branch -d base
git branch -D c4-c5branch
Keep in mind that โInitial commitโ is an empty commit without files, so don't be fooled. C5 commit is actually the first content-based commit.