You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Discarding changes takes huge amounts of time #7155
Even when discarding a few files at a time, the process can take upwards of ten seconds, when it should be instantaneous. (This has been a problem for a while, though qualitatively it seems to have gotten worse recently.)
There was a previous issue tracking this (#2629), but it has been closed, and this issue needs raised visibility, as it's an extreme source of frustration.
Here's a screen capture, but not that this problem occurs even for discarding one or two files.
I'm running GitHub Desktop 1.6.5 on macOS 10.12.6.
Reacted by cs4inctec, Patryk Rzucidło, antoidco, Oskari Liukku, Amin Ya, Fırat Esmer, Matěj Štágl, Ruben Grossmann, big dum, Jonas Wanke and 2 more
@varkor thanks for the feedback! We recently discussed this in #7015 and made a change in #7029 to show some progress while this work is happening. That should go out with the next beta, but please have a read of the changes and see if that makes sense to you.
(This has been a problem for a while, though qualitatively it seems to have gotten worse recently.)
I'd love to hear more details about this - I'm not sure we're measuring the "wall time" to complete these steps but maybe we could get that in to help us understand whether something has impacted this area.
For reference, this is the hot path when discarding changes in the app:
// N.B. moveItemToTrash is synchronous can take a fair bit of time
// which is why we're running it inside this work queue that spreads
// out the calls across as many animation frames as it needs to.
this.shell.moveItemToTrash(
Path.resolve(this.repository.path,file.path)
)
}
We're limited by the Electron API shell.moveItemToTrash() which we use here to preserve the changes. It's a blocking API that only takes one file at a time, which limits how quickly we can move many files across.
We recently discussed this in #7015 and made a change in #7029 to show some progress while this work is happening. That should go out with the next beta, but please have a read of the changes and see if that makes sense to you.
I've been following that change, which is definitely an improvement from the point of view of feedback, but it's really the duration that is the problem.
We're limited by the Electron API shell.moveItemToTrash() which we use here to preserve the changes. It's a blocking API that only takes one file at a time, which limits how quickly we can move many files across.
I imagine that synchronous nature of the API isn't actually so much of a problem, because in general, discarding only a few file changes is more common. However, discarding is slow even for a single file, which suggests that there's some constant overhead here (either in the API or elsewhere).
Perhaps it would be possible to have an option in the preferences that allows files to be removed directly, without going via the trash, if that's where the bottleneck occurs.
I appreciate that it's hard to debug this if others are unable to reproduce this. I would like to investigate, but I'm not sure I'll have time in the near future.
Dropping more-information-needed because I think we have enough information to go on.
I also encountered this recently when I was stuck with 3000+ uncommitted changes, and I used this flow on macOS because it seemed simple enough but I got stuck for a couple of minutes waiting for it to complete.
In the end I got impatient and closed the app because I wasn't sure how quickly it was progressing, and I didn't need to keep those changes in the trash.
just ran into this problems. tried to discard ~4300 files with changes.
all my 4 CPU core were satured, the whole machine got slow. it took almost 5 minutes to complete -> usability nightmare
looking into the task manager while waiting for it you can see a lot of git-processes getting spawned and go away.. I guess its one process per file beeing discarded.
running GH Desktop 2.2.4 on Windows10x64 with latest windows updates
As @staabm also mentioned for large sets of file discards it does per file deletion/removal for some reason instead of just git rming the entire file. Example case:
npm install to make your giant .node_modules/ folder
Then because you want to save it to test a change rename it to like .node_modules_clone/ (which isn't covered in your .gitignore)
Say you're done with messing with this node module stuff so you open GitHub Desktop and have 15K "changed" files now
If you use the GitHub desktop discard these get removed 1 by 1. BUT git status correctly lists that it's just a new folder so you could delete it all at once instead
Not a huge priority for me but was definitely strange behavior as I force stopped it on MacOS 7K files and 10 minutes in and proceeded to rm -rf the rest in 5 seconds .
This has gotten much worse for me recently. Discarding a single file now takes about 5-10 seconds, no matter how small the file.
Github desktop 2.5.4, Windows 10 x64.
I have a question / suggestion. In both the previous thread and this thread, the attitude seems to be "Does this happen often in your development?" My answer is "yes, the way I do things during testing, for better or worse, does include routine discarding of all changes"
I have an alternative question which I would say is a better question... do people ever need to retrieve their discarded changes often? I don't think they do. I don't see why they should be sent to recycle bin. Why not just do a simple delete and let that be the end of it? it's hard for me to imagine someone discarding all changes unintentionally.
Or, if if that is a concern, perhaps, give us a warning popup. I (and I think the others) would much rather have a warning popup followed by immediate delete rather than a few minutes of waiting for 100 files to delete (for me this waiting is frustrating, and it seems to be for others, also).
It's not even obvious to me why this should be a delete. If we are discarding changes, to me that is like reversing a diff. I would expect github to simply overwrite my files using the files from the last commit.
Another option: have the pop up give us the option "Permanent Discard" vs "Recycle/Trash" then we could click the one we want. And those of us who want a fast delete will start clicking "Permanent". This extra click will be worth it for those of us who want fast discards. In fact, I would even prefer that compared to sending to recycle bin!
Note: there can even be a checkbox for "remember my choice" / "apply this choice to all future discards"
+1 on windows 10
The problem is much worse if .gitignore is part of the discarded changes.
I presume that once the .gitignore file is deleted from disk the repo refreshes it's tracking state but doesn't have a .gitignore until the process finishes.... So things boil with node_modules for example.
Am I correct?
So (a) one can try to do this for aminya, (b) one can even fork aminya's branch and then synchronize to newest branch before making a pull request.
The developers did give feedback. So I would say this is now back on the community of users. Additionally, I find some amusement here, because just as aminya tried to "save" the developers work, in my view it is now incumbent on the community to save aminya from doing work :)
It seems that there must be professional programmers who are bothered by this issue, so one of them should be able to do the process I just described, above.
Activity
shiftkey commentedon Mar 25, 2019
@varkor thanks for the feedback! We recently discussed this in #7015 and made a change in #7029 to show some progress while this work is happening. That should go out with the next beta, but please have a read of the changes and see if that makes sense to you.
I'd love to hear more details about this - I'm not sure we're measuring the "wall time" to complete these steps but maybe we could get that in to help us understand whether something has impacted this area.
For reference, this is the hot path when discarding changes in the app:
desktop/app/src/lib/stores/git-store.ts
Lines 1175 to 1185 in 5ecf2e2
We're limited by the Electron API
shell.moveItemToTrash()which we use here to preserve the changes. It's a blocking API that only takes one file at a time, which limits how quickly we can move many files across.varkor commentedon Mar 25, 2019
I've been following that change, which is definitely an improvement from the point of view of feedback, but it's really the duration that is the problem.
I imagine that synchronous nature of the API isn't actually so much of a problem, because in general, discarding only a few file changes is more common. However, discarding is slow even for a single file, which suggests that there's some constant overhead here (either in the API or elsewhere).
Perhaps it would be possible to have an option in the preferences that allows files to be removed directly, without going via the trash, if that's where the bottleneck occurs.
I appreciate that it's hard to debug this if others are unable to reproduce this. I would like to investigate, but I'm not sure I'll have time in the near future.
shiftkey commentedon May 22, 2019
Dropping
more-information-neededbecause I think we have enough information to go on.I also encountered this recently when I was stuck with 3000+ uncommitted changes, and I used this flow on macOS because it seemed simple enough but I got stuck for a couple of minutes waiting for it to complete.
In the end I got impatient and closed the app because I wasn't sure how quickly it was progressing, and I didn't need to keep those changes in the trash.
staabm commentedon Dec 13, 2019
just ran into this problems. tried to discard ~4300 files with changes.
all my 4 CPU core were satured, the whole machine got slow. it took almost 5 minutes to complete -> usability nightmare
looking into the task manager while waiting for it you can see a lot of git-processes getting spawned and go away.. I guess its one process per file beeing discarded.
running GH Desktop 2.2.4 on Windows10x64 with latest windows updates
staabm commentedon Feb 11, 2020
just discarded ~15.000 files... took ~20 minutes to complete.. the workstation was nearly frozen during this process
3ygun commentedon May 12, 2020
As @staabm also mentioned for large sets of file discards it does per file deletion/removal for some reason instead of just
git rming the entire file. Example case:npm installto make your giant.node_modules/folder.node_modules_clone/(which isn't covered in your.gitignore)git statuscorrectly lists that it's just a new folder so you could delete it all at once insteadNot a huge priority for me but was definitely strange behavior as I force stopped it on MacOS 7K files and 10 minutes in and proceeded to
rm -rfthe rest in 5 seconds .Was on:
2.4.310.14.6cschreib-ibex commentedon Sep 4, 2020
This has gotten much worse for me recently. Discarding a single file now takes about 5-10 seconds, no matter how small the file.
Github desktop 2.5.4, Windows 10 x64.
ptkdev commentedon Mar 2, 2021
Same problem with 2.6.2 on linux and mac os.
AdityaSavara commentedon Nov 8, 2021
I have a question / suggestion. In both the previous thread and this thread, the attitude seems to be "Does this happen often in your development?" My answer is "yes, the way I do things during testing, for better or worse, does include routine discarding of all changes"
I have an alternative question which I would say is a better question... do people ever need to retrieve their discarded changes often? I don't think they do. I don't see why they should be sent to recycle bin. Why not just do a simple delete and let that be the end of it? it's hard for me to imagine someone discarding all changes unintentionally.
Or, if if that is a concern, perhaps, give us a warning popup. I (and I think the others) would much rather have a warning popup followed by immediate delete rather than a few minutes of waiting for 100 files to delete (for me this waiting is frustrating, and it seems to be for others, also).
It's not even obvious to me why this should be a delete. If we are discarding changes, to me that is like reversing a diff. I would expect github to simply overwrite my files using the files from the last commit.
Another option: have the pop up give us the option "Permanent Discard" vs "Recycle/Trash" then we could click the one we want. And those of us who want a fast delete will start clicking "Permanent". This extra click will be worth it for those of us who want fast discards. In fact, I would even prefer that compared to sending to recycle bin!
Note: there can even be a checkbox for "remember my choice" / "apply this choice to all future discards"
Monsoonexe commentedon Mar 29, 2022
Still a problem in 2.9.12. Discarding 12 changes (<5MB) can take on the scale of 30 minutes
ShaMan123 commentedon Sep 16, 2022
+1 on windows 10
The problem is much worse if
.gitignoreis part of the discarded changes.I presume that once the
.gitignorefile is deleted from disk the repo refreshes it's tracking state but doesn't have a.gitignoreuntil the process finishes.... So things boil withnode_modulesfor example.Am I correct?
1 remaining item
AdityaSavara commentedon Feb 12, 2023
@Mixarar
Which version number of the app are you using? The problem has gone away for me.
aminya commentedon Sep 22, 2023
I have the same issue. I don't know what GitHub Desktop is doing that takes so much time, but the following is instant:
Using
Version 3.3.1-linux1 (x64)firatesmer commentedon Sep 27, 2023
I have the same issue. Discarding the changes is taking too much time.
Windows 11 22621.2283GitHub Desktop 3.3.3ShaMan123 commentedon Sep 27, 2023
I am about to ditch github desktop
Too many issues including this major problem
misternebula commentedon Jan 16, 2024
Trying to discard 6k files, taking over an hour so far. No idea if it's actually doing anything
aminya commentedon Jan 16, 2024
I fixed the issue in this pull request last year September. However, the maintainers have not merged it yet.
#17436
steveward commentedon May 3, 2024
Reported in #18548.
nedredmond commentedon Dec 5, 2024
Currently waiting for it to discard almost 20k files. I wish there was a way to stop the process so that I could use git commands instead.
blackletum commentedon May 14, 2025
I think you should re-submit it, since they gave you all of 2 weeks to reply and then closed the request.
Your addition would be very appreciated.
AdityaSavara commentedon May 14, 2025
The changes that aminya made are shown as diffs:
https://github.com/desktop/desktop/pull/17436/files
https://github.com/shiftkey/desktop/pull/934/files
So (a) one can try to do this for aminya, (b) one can even fork aminya's branch and then synchronize to newest branch before making a pull request.
The developers did give feedback. So I would say this is now back on the community of users. Additionally, I find some amusement here, because just as aminya tried to "save" the developers work, in my view it is now incumbent on the community to save aminya from doing work :)
It seems that there must be professional programmers who are bothered by this issue, so one of them should be able to do the process I just described, above.
SolvalouArt commentedon Feb 1, 2026
Still having this problem in 2026. It takes 20 entire minutes every time i want to discard changes. This is a major issue.
Move discarded files to the Trash in batches