I have a git repository with some commits in it. I want to reproduce exact state of working directory as it was right after specific commit (Here i suppose that i've commited all changes that were made).

I tried to use git checkout, but this command doesn't delete existing files (which were added after desired commit) in working directory.

Simple example to illustrate my problem. I prepared repository using following commands

2 Answers
2

git checkout [<branch>], git checkout -b|-B <new_branch> [<start
point>], git checkout [--detach] [<commit>]
This form switches branches by updating the index, working tree,
and HEAD to reflect the specified branch or commit.
(...)
git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...
When <paths> or --patch are given, git checkout does not switch
branches. It updates the named paths in the working tree from the
index file or from a named <tree-ish> (most often a commit).

If, moreover you want to remove files that are not checked in the index, use git clean (read the man page, there's an "anti-oops" option you'll have to pass on the command line for it to work).