I have a main branch, called "dog", I commit there every day. Today my boss said that I made a mistake, I had to create another branch "cat" a week ago and put all my commits there during the week.
Well, now it's too late.
Is it possible to do it now: to create a branch as if a week ago and move all commits there, so that current "dog" looks like no one committed to it for the entire week?
Here's my theoretical course of action:
Step 1: Rename current branch from
git branch -m <oldname> <newname>
which turns into
git branch -m dog cat
Step 2: Create a new branch
dog from the last commit you want there to be.
For that, get the last commit you want the
dog branch to have and do the following:
git branch dog <sha1-of-commit>
git checkout -b dog <sha1-of-commit>
If you have already pushed to origin, you might have to
--force some things.