I have a large git project that I, stupidly, imported to eclipse and ran an autoformat on. Now, every file in the project is showing as modified. Rather than commit my for
That's a good use for git diff
and git apply
IMO:
git diff file2.cpp file2.h file3.cpp > ../my-changes.patch
git checkout ...
git apply ../my-changes.patch
After diff
, you can inspect the patch file to make sure that all your changes are there.
Note that you may need to use the --reject
option to apply, in case the patch does not apply cleanly. Also see the man page for apply.