Skip to content

Discard all changes is very slow, far slower than git checkout -- . #2629

Closed

Description

@abenhamdine

Description

Discard changes is very slow, far slower than git checkout -- .
For instance, for >800 files changes to discard, it last several minutes

Version

GitHub Desktop version: 0.8.0

OS version: Microsoft Windows [version 10.0.15063]

Steps to Reproduce

  1. Make >500 changes
  2. Select all, and clic right "Discard changes"
  3. Compare with same changes and git checkout -- . in bash

Expected behavior: faster, close to bash command time

Actual behavior: very slow

Reproduces how often: 100%

Activity

  1. niik commented on Sep 7, 2017

    @niik
    Member

    Hi @abenhamdine, thanks for opening this.

    You're right in pointing out that discard changes in GitHub Desktop is far slower than performing a checkout. We have made strides to improve this but the core difference is that git checkout -- . deletes any local working directory changes with no chance of retrieval again whereas GitHub Desktop moves discarded files to trash (Recycle bin) on Windows. We're simply limited by the APIs available to us here (electron only exposes methods for moving one file to trash at a time and that method is synchronous).

    Hopefully this is something we'll be able to improve upon going forward, either through better consumption of the underlying Windows APIs or possibly by providing a way to opt out of being able to restore discarded changes but it's not part of our immediate focus.

    I'm marking this as future-proposal and closing this issue out in order to keep our issue list manageable.

  2. billygriffin commented on Nov 14, 2018

    @billygriffin
    Contributor

    Hi @abenhamdine, thanks for this report. Given the relative infrequency of discarding a huge amount of changes and the limitations @niik described above, I'm going to remove the future-proposal label here. If we continue to hear reports from folks experiencing delays in their normal workflow as a result of something like this, we'll definitely revisit. Thanks again for letting us know!

  3. varkor commented on Feb 27, 2019

    @varkor

    Discarding all changes (even for relatively few changes files) is very slow for me — on the order of several seconds to over ten seconds for many changes. It's quite frustrating, as this is not an uncommon action for me. A way to clear changes (even if it means discarding permanently, without sending to Trash) would be a huge improvement for me.

  4. billygriffin commented on Feb 27, 2019

    @billygriffin
    Contributor

    @varkor Is discarding more than, say, 10, files a frequent occurrence for you? Just trying to understand how it's causing frustration. Also, how long does it take to discard a few files? Would you be willing to share a screen capture?

  5. varkor commented on Mar 4, 2019

    @varkor

    @varkor Is discarding more than, say, 10, files a frequent occurrence for you?

    Yes.

    Also, how long does it take to discard a few files?

    A surprisingly long time. I've just tried discarding 20 files and it took over 10 seconds. (I would expect discarding this few files to be essentially instantaneous.)

    Would you be willing to share a screen capture?

    discard-changes

    (The type of changes here are not necessarily representative, but the time it takes is.)


    As an aside, while this problem persists, it would be nice if the modal dialogue could display some feedback — at the moment you click "Discard", and nothing appears to happen until discarding completes.

  6. varkor commented on Mar 5, 2019

    @varkor

    Note that discarding even a couple of files can take ~5 seconds to complete. This problem does not just occur with many files.

  7. Mark-Hetherington commented on Nov 14, 2019

    @Mark-Hetherington

    I'm encountering this when switching from a branch that ignores node_modules to one that does not. I might have 10,000 files to discard. I've learnt it's best to just go and shift+delete the folder rather than attack it through github desktop.

  8. jswigart commented on Nov 30, 2022

    @jswigart

    This needs an option to discard the files without recovery, and some text that warns of the cost. It's ludicrous how long this takes

  9. Mixarar commented on Feb 11, 2023

    @Mixarar

    yep, some big projects that are made using game engines, generate a large amount of files during editing(5k, sometimes even more). And i dont really care about those files being saved to the bin, i would like to just discard changes without recovery.

  10. Flavelius commented on May 24, 2023

    @Flavelius

    Same here, unity (game engine) uses .meta files for everything, effectively doubling the amount of tracked files, and this makes it take a surprisingly long time to discard all changes (>2 minutes for ~1200 files). And cancelling doesn't even work while it's doing this.
    Edit: a workaround is to stash the changes and discard the stash, interestingly this happens instantly.

  11. astyd256 commented on Dec 11, 2023

    @astyd256

    Bruh six years still so bloated. ☠
    How can you do nothing and mark it as closed. 🤦‍♂️
    At least add an option to delete perma

  12. Shreeniwas1 commented on Aug 12, 2024

    @Shreeniwas1

    Bruh six years still so bloated. ☠ How can you do nothing and mark it as closed. 🤦‍♂️ At least add an option to delete perma

    yeah at least

  13. blackletum commented on May 14, 2025

    @blackletum

    Bruh six years still so bloated. ☠ How can you do nothing and mark it as closed. 🤦‍♂️ At least add an option to delete perma

    idk why the GD team disregards things like this that are simply just common sense and have been asked to be looked into for anywhere from 5-10 years ago in some cases.

    A bit maddening.

  14. Nexesenex commented on Jun 14, 2025

    @Nexesenex

    Bruh six years still so bloated. ☠ How can you do nothing and mark it as closed. 🤦‍♂️ At least add an option to delete perma

    idk why the GD team disregards things like this that are simply just common sense and have been asked to be looked into for anywhere from 5-10 years ago in some cases.

    A bit maddening.

    Yeah, clearly.

    I also have this problem, and it'd be great to have a solution, instead of wasting ages for nothing.

  15. JohnJHargrove commented on Nov 7, 2025

    @JohnJHargrove

    Having this issue today. Discarding changes feels like it's never going to end.

    I can't tell if it's still actually working or if it's permanently hung.

    I'm now trying to learn command prompt workarounds because I'm hard blocked by github desktop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions