Question: Before commiting my source files, I would want to apply some `sed` commands on all of them.
In case I make a mistake in the `sed regex`-es used, I want to come back to the files' original state.

I know `git stash` saves the unsaved changes, but it also removes them from the current working directory.

Is there a way of stashing, while keeping the changes?

Answer: 
sed -i.bak regex file

Will make a backup

Or

```
 git add file
 git branch sed_regex && git checkout sed_regex

```

If you mess up, just revert to main branch
`git` *is* your backup.

1. Commit the files prior to running `sed`.
2. Run the `sed` command.
3. If all goes well, commit again, then rebase to squash the pre- and post-`sed` commits.
4. If the `sed` failed, just checkout `HEAD` to restore your state at step 1.