How do I return my working directory to the state it would be in if I made a new clone and checked out the current version?
For subversion I’d do:
$ svn status --no-ignore | awk '$1 == "?" { print $2 }' | xargs rm -r
and for mercurial:
$ hg status --ignored --unknown | awk ' ( $1 == "?" ) || ( $1 == "I") { print $2 }' | xargs rm -r
So answers in the same line are fine. But something like git checkout --clean -r b4a23 would be better.
(prepare to loose all local, uncommited changes:)
As mentioned, you can use
git stashto temporarily save a reference to your local pending changes on a ‘pseudo branch’ (i.e. a stash).