But this will still leave the fetched objects in your repository, so to really clear them out, you must then also delete the intermediate reflog entries, and then run git gc -prune=now, which requires a lot of care and will discard all unreferenced objects, not just ones brought over by the most recent fetch.ĢI think one could argue that "running low on disk space" might be a reason to do this, especially if a large object was accidentally pushed to the remote and will be removed from the remote by the next fetch. If you do manage to undo the fetch, the one run tomorrow will have to re-do the work done today, so this is a net loss: you just spent some effort so that your git will have to bring more code over the network tomorrow.ġIt's not that difficult if you have remote reflogs (which you probably do): just use the remote reflogs to find remote-tracking branches updated in the most recent fetch-this same information may also still be available in the FETCH_HEAD file-and then use git update-ref to point those references back to their previous reflog entries. This has no effect on any of your work-tree files, and if you run git fetch again tomorrow, any work done today can be skipped tomorrow. Remember, what git fetch does is call up the remote, get a list of branch-name to SHA-1 mappings, bring over commits and other objects you need in order to store those in your repository, and then update your remote-tracking branches so that they point to the remote's current (as of the time you just now phoned it up) branch tips. It is difficult 1 to "undo" a git fetch, but there is never 2 any reason to need to undo a git fetch.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |