0

Im using the git client for osx.

I have made some changes to my branch. I do not wish to commit these. How can I revert to my latest commit of the branch?

panthro
  • 22,779
  • 66
  • 183
  • 324

1 Answers1

1

I'm not sure which client you're talking about, unless it's the command-line client, but one of the following should set you up.

git reset --hard HEAD       # Which reverts your local branch to the last commit
git checkout -- [filename]  # Un-stages changes with have been added, but not yet committed
git checkout [commit hash] [filename] # Grabs the version from the commit specified by [hash]

The other possibility is that the changes haven't even been added yet, and that you don't have to do anything. If you want to keep those changes around for later, but do not with to commit them to the repository then you can do a:

git stash

All these commands' manuals should be available via:

man git-reset
man git-checkout
man git-stash
jefflunt
  • 33,527
  • 7
  • 88
  • 126