How to "git reset --soft HEAD^" a single file?

git

Solution

Are you trying to do `git checkout $COMMIT_HASH some_file.ext`?

You can use this to revert a file to its previous state, and git stages this change.

Problem

When I am splitting a commit during interactive rebase, I often would like to extract specific files from the last commit. My current process is to - Copy the last commit message to my clipboard, - git reset --soft HEAD^ (last commit is undone, changes are staged) - Unstage files I wanted extract - Re-commit (pasting in the copied commit message) - Add/commit the remaining files - Continue with rebase I feel like this would be simpler if I could soft reset a specific file.

Original source