24-10#
git add changes to specific commit#
While working on my feature branch, I wanted to put currently staged changes into a previous commit with hash 3ff52a6d5
.
Here’s how:
git stash
git rebase -i 3ff52a6d5^
# Change `pick` to `edit` for 3ff52a6d5
# Note the ^ after 3ff52a6d5. Rebase targets the parent, so we need to go one
# commit futher back in history.
git stash pop
git ci --amend
git rebase --continue