Generated File: Do Not Edit Directly Edit the source files and rerun the generator.
Git Tips Slides
PageUp x2: previous · PageDown x2: next · Home: index

Restore interactively

Imagine you are working on a feature branch. But you want to restore some changes to the original version of the main branch. You want to do that interactively because some changes in the file should stay. Use -p like "patch":

git restore -s main -p -- path/to/file.txt

This works for directories, too:

git restore -s main -p -- path/to/dir
Generated File: Do Not Edit Directly Edit the source files and rerun the generator.