How do you control the order in which files appear in a GitHub gist

Since at least 2018, the order is alphabetical, with periods and numbers coming before letters.

That is, as mentioned in Andrew D.Bond's answer:

  1. $
  2. . (dot)
  3. Numbers
  4. Leading space (although the space doesn't appear after saving, the sort order is still updated)
    (although bis, in Sept. 2020, IvanaGyro adds in the comments leading spaces will not affect the order any more)
  5. _ (underscore)
  6. Letters (case insensitive)

Around 2013-2014 a different order was used.


They are ordered automatically by name, following the ASCII table.

Unfortunatly, right now, it is not possible to order them by dragging, but there is a trick. You can control the order by adding one or more spaces before the name. The space will not be shown after editing, but the order will change.

E.g: lets say we have 3 files with the automatic order:

  • AFile.java
  • Readme.md
  • SomeFile.txt

We can invert the order by putting spaces like this:

  • (space)(space)SomeFile.txt
  • (space)Readme.md
  • AFile.txt