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?

  • Strange git merge issue
  • How do I find the next commit in git?
  • Hosting a Repository website on Github not working?
  • Using Git on Windows
  • How to push Tag to Bitbucket Git Repository in Bamboo from Cake build task?
  • Updating author information on annotated/signed tags in git using filter-branch or a similar tool
  • How to replace svn's sub directory vendor branch with git's subtree merge
  • Jenkins pipeline - git branch
  • How can I visualize GitHub branch history on Windows?
  • Git server configuration
  • Linux kernel configuration - enabling CONFIGURE_LOCALVERSION_AUTO
  • Rename file with Git
  • 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.