Q:

is `git diff` able to apply diff to the current working tree?

I have a set of commits, say from commit A to commit Z. That set alters set of files in the repository. That is like development history of the feature with a bunch of tries and failures.
Now I want clean up the history, reduce number of commits and remove wrong attempts from the history. I want to leave my current development branch untouched and create clean history in another branch called for example feature-rc1. Later this branch will be merged into upstream repository.
So my plan is to take all changes made to some file file1.cpp and apply those changes to the working tree of feature-rc1 branch. Then I will do the same with file2.cpp and file3.cpp. Then I commit changes and continue with another files and commits. So my basic operation will look like this:
git diff A Z -- file1.cpp >temp.diff
patch -P1 <temp.diff
git diff A Z -- file2.cpp >temp.diff
patch -P1 <temp.diff
git diff A Z -- file3.cpp >temp.diff
patch -P1 <temp.diff
git commit -a -m "commit"

My question is if it's possible to avoid using temporary diff files and external utilities such as patch? It would be great if git diff have built-in ability to apply diff result to the current working tree or if there is another git command with the same functionality.
Update: I think it is possible to avoid temporary files like this:
git diff A Z -- file1.cpp | patch -P1

But it would be great to avoid patch too:
git diff A Z -- file1.cpp | git ????

What could be there in place of ????

A:

So the best answer to my question was provided in comment by @torek.
And the answer is git apply command which can apply git diff's output to the working tree.

