How do you control the order in which files are displayed on GitHub?

Is there a way to control the order in which files are displayed in a view? They do not seem to be alphabetical or chronological. I would like README.md to appear as the first file in a multi-user style , but I could not “delete” the file and re-add it, it seems that something is changing.

Is there an order for these files that I don’t see, or does GitHub maintain a priority list in the file list?

+58
github gist
Jul 15 '13 at 22:54
source share
3 answers

Starting in 2018, the order is in alphabetical order, with dots and numbers before the letters.

Around 2013-2014, a different order was used.

+70
Jul 16 '13 at 5:53 on
source share
— -

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

Unfortunately, right now they cannot be ordered by dragging them, but there is a trick. You can control the order by adding one or more spaces in front of the name. After editing, the space will not be displayed, but the order will change.

For example: let's say we have 3 files with automatic order:

  • AFile.java
  • Readme.md
  • Somefile.txt

We can invert the order by placing spaces as follows:

  • (space) (space) somefile.txt
  • (space) Readme.md
  • AFile.txt
+9
Jul 20 '16 at 9:47
source share

As @VonC was already mentioned in his answer, the order is ascetic. A quick fix would be to prefix all files with numbers indicating the order in which you want the files to be displayed, for example 0_, 1_, 2 _, ... 9_. Please note that this solution will not work outside of 9 files, since 10_ will be displayed before 2_. In this case, it is necessary to use two digits 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 for me there are more than 10 files that will be used in essence.

0
Jun 10 '16 at 9:43
source share



All Articles