GitSamples-GIT: Github Links
Links to directories in README.md files not working as expected on github. The reason that all files are stored beneath the base path blob,
blob/<branch>/<path>/<fileName>
whereas directories are store beneath the base path tree:
tree/<branch>/<path>
- Relative directory links not using parent navigation ".." works, since Github translate "magically": dir
- Relative links to a parent directory does not work!. One has write a link including branch for it. This is very nasty, since every link to a parent directory is broken when renaming or branching!
- A "dot" works in sub directories, but not branch root README.md.
To create a link to the actual directory in the README.md file one has to use a link including the branch.
- /../../tree/master: To master
- /../../tree/github-readme-links: this directory as branch root. "dot" does not work.
- dir: sub directory
- dir/subdir: sub sub directory
All file entries starts with a blob in the path. So there are no problems linking to files from a README.md documentation.
| Link | works | Remarks |
|---|---|---|
| fileRoot | ok | |
| /fileRoot | ok | |
| ../github-readme-links/fileRoot | ok | include branch name |
| ../../blob/github-readme-links/fileRoot | ok | |
| /../../blob/github-readme-links/fileRoot | ok | |
| GitSamples-GIT/blob/github-readme-links/fileRoot | nok | Proposed in stackoverflow |
| blob/github-readme-links/fileRoot | nok | |
| github-readme-links/fileRoot | nok | |
| /github-readme-links/fileRoot | nok | |
| dir/fileDir | ok | |
| dir/subdir/README.md | ok |
All directory entries starts with tree, all README.md files with blob. Some type of links will magically replaced.
| Link | Works | Remarks |
|---|---|---|
| dir | ok | automatic replacement blob by tree |
| /dir | ok | automatic replacement blob by tree |
| ../github-readme-links/dir | ok | automatic replacement blob by tree |
| ../../tree/github-readme-links/dir | ok | change from blob to tree |
| /../../tree/github-readme-links/dir | ok | change from blob to tree |
| GitSamples-GIT/tree/github-readme-links/dir | nok | Proposed in stackoverflow |
| tree/github-readme-links/dir | nok | |
| github-readme-links/dir | nok | |
| /github-readme-links/dir | nok | |
| / | nok | points to the non-existing target https://github.com/fluentcodes/GitSamples-GIT/**blob**/github-readme-links |
| . | nok | points to the non-existing target https://github.com/fluentcodes/GitSamples-GIT/**blob**/github-readme-links |
| .. | nok | points to the non-existing target https://github.com/fluentcodes/GitSamples-GIT/**blob** |
| dir/subDir | ok | automatic replacement blob by tree |
| ../tree/master | nok | |
| ../../tree/master | ok | Switching to branch. |
| /../../tree/master | ok | Switching to branch. |