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

点点圈 提交于 2019-11-29 20:49:49
VonC

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

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

As mentioned by @VonC in his answer, the order is asciibetical. Quick solution would be to prefix all files with numbers indicating the order in which you wish the files to appear, example 0_, 1_, 2_, ... 9_. Note, this solution will not work beyond 9 files as 10_ will appear before 2_. In that case, two digits need to be used 00_, 01_, 02_, ..., 09_, 10_, 11_, ... This can be generalized to any number of digits in the number of files. Although, it seems less likely, to me, that more more than 10 files to be shared in a gist.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!