Stage the parts you want with git add -p, then discard (git checkout -- filename) the unstaged changes.
Update for Git 1.6.5+
In version 1.6.5, Git learned to checkout with a -p/--patch flag. You can discard chunks in one step with git checkout -p -- filename.
git checkout -p -- filename
能够按区块进行回滚工作区。