git checkout --orphan assets
git reset --hard
cp /path/to/cat.png .
git add .
git commit -m 'Added cat picture'
git push -u origin assets
git checkout --orphan assets
creates theassets
branch without any parent historygit reset --hard
clears the working tree
When viewing a file on GitHub, you usually see the version at the current head of a branch. Your markdown would look like this:
![Readme](https://github.com/{username}/{repo}/blob/{branch}/README.md)
Refers to the {username} {repo} repository, and shows the {branch} branch's current version of the README.md file.
The version of a file at the head of branch can change as new commits are made, so if you were to copy the normal URL, the file contents might not be the same when someone looks at it later.
If you need to always reference a specific version create a permalink by viewing the file on GitHub and
pressing y
to convert the asset's URL into a permalink that can then safely be shared.
Alternatively:
git checkout assets
git log --pretty=format:%C(yellow)%h\ %ad%C(red)%d\ %C(reset)%s%C(cyan)\ [%cn]\ %C(yellow)%cr --decorate --date=short
git log ...
lists the branch commit history; the first column per line is the short commit SHA
Then in your markdown you can reference the permalink:
![A cat](https://github.com/{username}/{repo}/blob/{commit-SHA}/cat.png)