I did some modifications to the AGENTS.md file in my GitHub repo and I want to add this change to the commit that added this file in my feature branch. Normally I would:
- Stash my changes
- Run
git rebase -i mainand mark the target commit withedit - When the rebase stops at the target commit, I would apply my stashed changes and amend the commit with
git commit --amend - Finally, I would continue the rebase with
git rebase --continue
But there is a much easier way to do this! I can use the --fixup option of git commit to create a new commit that will be automatically squashed into the target commit during a rebase.