I'm a beginner with git and having some problems while trying to revert everything to the last time I committed. I don't mind losing any of the changes I just want to undo everything. I tried this:
git revert b78da61000bc049133f4a5f7df6ddb3b6407454f
But I'm getting
error: Your local changes to the following files would be overwritten by merge.
Please, commit your changes or stash them before you can merge.
Aborting
I don't want to commit these new changes because obviously they don't work and I just want to get rid of them. Any suggestions?
git revert means to create a new commit which 'undoes' the changes done in the specified commit.
You want:
git reset --hard <commit>
(This removes any uncommitted changes from the working directory, and sets the current branch to the specified commit)
Note that reset modifies history. So if you have already pushed those commits, it's not advised to just remove them by resetting them, because when you (force) push the new history, others have to rebase their changes onto the new history.
See man git-reset and Reset Demystified