Sometimes, while working on a branch, I want to add a new commit before the first commit.
The best way I found until now to do this are the following steps.
- While on the work branch, make an empty commit with
git commit --allow-empty -m "Empty commit"
- Interactively rebase on the branch from which we checked out, move the empty commit to be the first one and choose to
- While in
editof the empty commit make the wanted changes and
git commit --amendthem to the empty commit
git rebase --continueand fix conflicts if needed