Reset or revert Gist to an older commit state using either Github web interface or desktop app
Asked Answered
T

3

11

I am trying rollback a Gist to an older state through either the web interface or the Github Desktop app. I've seen solutions that seem to show how one might do this using the command line. However, I can't figure out how one can do this without using the Command Line Interface.

Is the CLI the only way to rollback history? If so, is there a reason for this limitation of the web interface and desktop app?

Tetanus answered 2/9, 2015 at 11:22 Comment(7)
By "rollback", do you mean revert commit(s) or reset (i.e. delete recent history) ? I can't think of a way to do either using the GitHub web interface alone.Successor
what do you have against the CLI?Pearlene
@Jubobs: I mean to set my state to a state back in time, essentially erasing all commitsTetanus
@Ursus: I have nothing against CLI, I just find it odd going back in time can't be done in 2/3 of the tools available.Tetanus
"If so, is there a particular, fundamental reason for this limitation of the web interface and desktop app that I simply don't understand?" Yes. The fundamental limitation is "that's the way the GitHub developers wanted it."Lepper
Can you shed some further insight or reasoning?Tetanus
Windows 7 or later try using desktop.github.com which gives you a decent set of tools and options for the platform. you can see what defaults was prefered during my install in this other issue github.com/mbostock/gistup/pull/25#issuecomment-143466842 which involves GistVivanvivarium
F
8

git clone

Use one of the following URIs to clone your git

$ git clone [email protected]:<gist_hash>
$ git clone [email protected]:<gist_hash>.git

# navigate to directory
$ cd <gist_hash>

rebase

Update your branch however you'd like, using rebase for example

$ git rebase --interactive
pick 8c199dc 8c199dc373b5be96df92131e3c0631514636583d
- pick dc968d3 dc968d3e2cb3a571ed50233047c3d83ba3f6e209

force push

You'll have to force push up your changes to overwrite previous commits

$ git push -f
Fustian answered 19/8, 2018 at 2:34 Comment(1)
that's gloriousStrophe
H
1

I mean to set my state to a state back in time, essentially erasing all commits

That is called a git reset, and generally frowned upon whenever there is collaboration on the same remote repo: a git push --force publishes the revised history, and forces everyone else to carefully reset his/her own clone in order to not re-introduce by mistake the deleted commit.

That is why such a feature is not exposed in a GUI.
Although, when it comes to gists (generally managed only by their GitHub account owner), one might consider allowing an easier reset through the GUI.
Yet, that is not the case right now, probably to keep the user interface coherent between GitHub for Desktop for regular GitHub repos and for gist repos.

Havenot answered 17/9, 2017 at 15:22 Comment(0)
C
1

I would do it manually by finding the revision I want to revert to, copying the markdown of that revision and create a new revision with that markdown.

  1. Click the "Revisions" tab
  2. Scroll down to the revision I want to revert to
  3. Click the "View" button to see the html of a revision
  4. Click the "Raw" button to see the markdown of the revision
  5. Copy that markdown
  6. Click the "Edit" button, paste that markdown and click the "Update" button
Chung answered 10/5, 2018 at 13:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.