Blankman
Blankman

Reputation: 267320

Stash what I am currently working on, and revert back to the last commit

My web application was working fine at my last commit, i.e.:

git add -A
git commit -m 'asdf'

I don't want to throw away what I have now, is it possible to stash what I have now, revert back to the last commit?

And how can I get what I stashed back once I figure out what happened?

Upvotes: 3

Views: 80

Answers (1)

VonC
VonC

Reputation: 1329532

Yes, for any non-committed content, git stash should be enough (and git stash pop to restore)

Should you have made one more commit, you could name that branch with a git branch tmp, and then git reset --hard HEAD~1 to reset the current branch HEAD.

Upvotes: 4

Related Questions