If you're using git to manage you files, and you have some changes to some files, and you want to throw away the changes (i.e. revert to the previous checked in version), then you can do it with this:
git checkout path/to/myfile.ext
(replace the path/to/my/file.ext with the path/filename of the file you want to 'revert')
This is the git equivalent of svn's svn revert path/to/myfile.ext
I was doing some work on a git project, on the master branch, and made 2 commits. Then I thought I should really do this on a separate branch, instead of master. But I've already committed twice to master!
Luckily git is great.
Firstly, you want to move to your feature branch, so do git checkout -b name-of-new-branch, tis'll create a new branch with the 2 new commits.
Then switch to master with git checkout master, and look at the logs, with git log. You'll see your 2 new commits that you want to 'get rid of'. Look for the commit just before the 2 commits, and look at the commit: … line. Copy & paste the part after the :, it'll look something like: 09c171332d969c55bceb80db58c70a710be994e3.
This is the id of a commit, (and tree of files), and it can act like a branch. You can checkout that 'branch' with git checkout 09c171332d969c55bceb80db58c70a710be994e3, which will give you a few lines message about how it's a "detached HEAD". Once it's checked out, give this a name, with git checkout -b master2. We are calling this new branch, master2. It's got everything in master, but without the 2 commits which want to have on the feature branch. Then just delete the old master branch (git branch -d master), and rename master2 to master (git branch -m master2 master).
master will now have everything but without the last 2 commits, and name-of-new-branch will have master and the 2 commits, so you can continue work there.
Obviously things get a bit more complicated if you've pushed master somewhere or if you have a lot of local changes. Best to not do it in that case.