Git erased my changes, can I get them back

I had some changes in a branch, we’ll call it branch2. I switched to the master branch without committing the changes. I’m guessing this is a no-no because when I switched back to branch2 all of my change were gone! It sure would have been nice if the GitHub client for mac would have warned me. Is there anyway I can undo this action and get my changes back?

  • Configuring Eclipse / EGit to track an upstream repository
  • How to add file to a previous commit?
  • See complete history of changes in smartGit
  • When a git commit has multiple parents, what are the stats calculated against?
  • Remove the whole history of a specific branch from git repository
  • Why do I have to use “git commit -a” rather than just “git commit”?
  • Why is the Python calculated “hashlib.sha1” different from “git hash-object” for a file?
  • Visual Studio integration with free SCM
  • Git console in Netbeans
  • What is the svn:mergeinfo equivalent for git?
  • How to reference remote repositories in a git alias?
  • Git between multiple projects
  • One Solution collect form web for “Git erased my changes, can I get them back”

    If it wasn’t committed, then there’s nothing to do. Although, this is weird because normally git won’t allow you to switch branch if you have uncommitted data in your working directory (I don’t know for github for mac exactly).

    You can always check git reflog to see if you have committed your data.

    Git Baby is a git and github fan, let's start git clone.