GitHub wiki directories - github

Does the wiki that installs with a GitHub repo support directories? Our wiki is cluttered with pages, and we are looking for a way to organize them better.
We tried pulling the repo, creating local directories, and moving things around, but when committed back, the wiki didn't pick up the changes.

I was having the exact same issue and tried variants of what you tried. Nothing stuck. Asked GitHub support about it and received a reply that essentially said "No, but we'll let the developers know that people are interested in this feature."
So the short answer is "No", and the long answer is "No, but maybe in the future."

Actually, it looks like github added support for directories recently.
I was able to do the following:
Move an existing markdown file to a new directory.
Create a new markdown file in an existing directory (created in the former step).
Create a new markdown file in a new directory.
In all cases, the existing pages were still there and new pages were added.
The one constraint that remains is that your file names must be unique. If you have more than one file with the same name, only one of them will show up in the wiki (I'm not sure which.. ).

The GitHub wiki (aka Gollum) does use directories but not in the way you may expect.
The documentation on the Gollum wiki could use some work but this is what I have figured out mostly via testing.
All files appear in the root of the wiki no matter where they are placed in the repo.
_Header, _Footer and _Sidebar files are per-directory, but inherited if there is
none present in a child folder.
File links can be relative to the source file (keep your files with your content).
So, if you want directories for namespacing you are out of luck. Consider using the {namespace}-{page} scheme for namespacing.

It's not the an ideal solution but the workaround would be to create a custom sidebar where you create a table of contents with links to your pages. I find this to be better than folders anyway because it allows you to have a link to a single page under multiple hierarchies.

Actually, there is still a limitation. Yes, you can add 1 level (so, 1 subfolder). But that's it! I refactored my whole documentation layout, creating multiple levels of subfolders for organisation, but that was a no-go.
sigh
I must say: I'm appalled by this Gollum thing. I'm surprised Github even picked it up.

Well, that's a disappointing missing feature!
What I try to do is to actually have directories under a docs directory and in each one, a README.md file.
Not great...but works for documentation and organizes stuff.
If you want to go further, you can have a different branch only with these files.

Still no intention of adding this 9/2022.
https://github.com/orgs/community/discussions/23914

Related

How to expand package-lock.json diffs in github by default using .gitattributes

By default, the Github web UI collapses changes to package-lock.json files. I understand why most people would prefer this, but I'm working on a project where we would prefer to see the changes expanded.
Searching around, I'm guessing that I need to use the Linguist language in a .gitattributes file, but I haven't had any luck finding examples or doc on how to express this. All blog posts and questions I find are targetted the opposite way (how to hide, ignore, merge changes to this file).
Does anyone know how to tell Github that I want to see changes to my package-lock.json file expanded in the UI? We use Github Enterprise at work, so hopefully the answer isn't any different there.
With help from someone on the Linguist project, I learned that the .gitattributes syntax looks like this:
package-lock.json linguist-generated=false

GitHub changelog links to commits

Some projects have a CHANGELOG.md file where each version links to the range of commits that were made for that version. For example, this one. It looks like these links are automatically generated somehow, because the markdown only contains [1.0.0] where the rendered document has a link to https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0.
How does that work? I've tried to do something like this on my own project, but the rendered document just said [1.0.0]; no link was generated.
Presumably it has something to do with the tags, which follow a similar pattern (v1.0.0), but when I tried to create similar tags in my project, it still didn't work.
I also could find no reference to this on the GitHub help, or anywhere else for that matter.
Is this indeed an (undocumented?) feature of GitHub? If yes, how does it work? If no, how do these projects do it?
Note, I'm not interested in automatically generating a changelog from commits like this project does. I'm just interested in the mechanics of these hyperlinks.
You need to look beneath the surface of the Markdown, it's a simple trick he done by using the file compare feature to compare tags.
If you look at the RAW file, you should notice at the bottom he added links to each version number that has a compare link assigned to it.
## [1.0.0] - 2017-06-20
[1.0.0]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.3.0...v1.0.0
With pretty mode, you would see the link to the compare page.

Gist Vs. Repository for Tutorial

I'm publishing a tutorial that includes a lot of code interspersed with documentation. I'm considering two ways of hosting the code:
Separate git repository with code files and markdown files explaining the code
Github gist containing both of these
Are there advantages of hosting in a gist v/s a repository? When would one prefer one of these over the other?
Gist is a simple way to share snippets and pastes with others.
Whereas Repo is simply a place where the history of your work is stored.
There is no good answer, it's personal preference. I make mine a conceptual distinction. If it's code designed to demonstrate a technique, teach a principle, or show off a solution it goes in a gist. Doesn't matter if it's one file or 30 files. If it's actual code intended to be run, used as is, or forked as boilerplate I put it in a proper repository.
If you use markdown files for your tutorial, now there is one important difference, even if you are only creating one file (and specially if it is a long one).
Since April 2021, .md files created in github repositories now include an automatic Table of Contents which greatly improves navegability. See this related SO answer for more info.
As far as I know, this automatic ToC does not exist in gist-created .md files, so I'd rather go for a repository in this case (OP mentioned "a lot of code interspersed with documentation").

How should I provide guidelines for issues? (Github)

I want to give the users of my repository some info on how they should report issues and what info they should provide. What is the best way to present this information, and where? I was hoping there would be a readme on the /issues tab but there seems no such option. Maybe I should create an 'issue' named 'Read before creating issue'?
If you're worried about the added clutter in the root directory of your project.
You can put CONTRIBUTING.md, ISSUE_TEMPLATE.md, and PULL_REQUEST_TEMPLATE.md files in the project directory.
Yes, it will easy both parties to creating the issue or pull request fill all info.
What is the best way to present this information, and where?
Put it into your this three files and file name should be same as here.
More information about it
I'm not sure if github exclusively provides any such feature. Alternatively, you could include the guidelines (or link to- how to create an issue) in the readme.md file at the main branch of the project (e.g. a section #HowToCreateAnIssue along with other sections). At least, this is what I follow.
For my Projects (and I guess thats how most People will handle it) I added a readme to the Projects repository and create a link to the most important wiki pages. The wiki will be managed as an additional repository and provides possibility to store Information and updates as needed.
If you also have a Webpage created this could also be a place to add some Information on how to participate as a contributor.

Single-file diff between two commits

In github, is it possible to show the diff of a single file between two commits?
One can readily diff two commits, and it is possible to link to the anchor for a specific file in those two commits, but all files are included in that view. For example, https://github.com/adamginsburg/APEX_CMZ_H2CO/compare/a94a962db51e0f4e73ec3ba4170a0ca8269548da...adamginsburg:master#diff-22
I would like a similar view, but without the other files.
(I know how to do this on the command line with git, but I want to share this link with collaborators, so the command line approach is not relevant for this question)
I think your question can be consider a duplicate of this one :
How can I generate a diff for a single file between two branches in github
Unfortunately, the accepted answer doens't answer your expected behavior.
I really tried to exclude the other files without success, and since there not seems to have other means to filter it out but html anchor pointer, I guess what you already have is what best available with Github to pin point the change you want to talk about with your peers.
I can recommend you to use Vscode with the Git History, I know is not the same as having in Github but it allows you to see the changes of the code according to an specific file or the entire project, comparing with the actual code, see all the changes of specific file through the commits, I work with this tool and this is helpful for me, hopefully it will be helpful for you.
Git History Example Usage
You can use the GitHub File Diff extension available for Chrome and Firefox.
Disclaimer: I made this extension.