How can I undo discard changes in GitHub Desktop?

52,943

Solution 1

Emailed the Github support team and was told that after this option disappears, there is no other way to Undo the change. They may implement this feature at a future time.

Solution 2

As of 5/8/18, and if you're using the latest version of github desktop or github desktop beta, uncommitted discarded changes are now copied over as new files and put into your trash/recycling bin.

This is what the current prompt looks like:

enter image description here

Solution 3

First of all, Don't Close the VS Code.

Then open all the Files Where you have done Discard Changes.

Press Ctrl+z for Undo & CTRL+S for saving the changes.

It's worked for me.

Solution 4

You can find those discarded files in the recycle-bin.

Solution 5

GitHub Desktop Menus -> Repository / Restore Discarded changes

Share:
52,943

Related videos on Youtube

Franck Dernoncourt
Author by

Franck Dernoncourt

Updated on July 09, 2022

Comments

  • Franck Dernoncourt
    Franck Dernoncourt almost 2 years

    Is there any way to undo discard changes in GitHub Desktop, after the Undo button has disappeared?

    enter image description here

    I am talking about GitHub Desktop's undo feature, not git in general.

    • Franck Dernoncourt
      Franck Dernoncourt about 8 years
      @TheGeorgeous Thanks, if I use Git Shell, which command should I run?
    • Vartika Gupta
      Vartika Gupta about 6 years
      You can check recycle-bin once.Sometimes discard file are there in recycle bin and you can restore the same but remember the version you have discarded will only appear. If you have done changes after discarding that will not merge into it.
  • Asking Questions
    Asking Questions about 7 years
    Where is the GitHub desktop Menus?
  • chrismarx
    chrismarx almost 6 years
    This answer is for an outdated version
  • chrismarx
    chrismarx almost 6 years
    This menu item has been removed, see this answer: stackoverflow.com/a/50240230/228369
  • chrismarx
    chrismarx almost 6 years
    This only applies to files that actually were committed, in this case, we're looking for files that were never staged or commited
  • Ishani Gupta
    Ishani Gupta about 5 years
    Saved my day !!
  • unobatbayar
    unobatbayar over 2 years
    You're a legend.
  • Diogo
    Diogo over 2 years
    Saved my day bro [2]
  • iamcastelli
    iamcastelli over 2 years
    Thank you a thousand bunch. It's at times like this where a wish I could buy a coffee/beer for the devs/product team who thought of such a helpful feature. Saved me a to of sweat and tears.
  • b.stevens.photo
    b.stevens.photo over 2 years
    As with everyone else here you saved my day and probably a weeks worth of work
  • underdark
    underdark over 2 years
    Thank you, this saved my work after accidentally deleting a repository.
  • S.Hasan
    S.Hasan about 2 years
    Four years and still this is saving lives! Thank you
  • Fred Johnson
    Fred Johnson about 2 years
    you saved weeks of work. ty!
  • Hitesh Kushwah
    Hitesh Kushwah almost 2 years
    Thnx man you save my life my whole 1-month work saved