This is my developer reading list - recent articles and books I've read, with occasional thoughts.
View my full reading list.
This reading list is git-based - designed to be easy to update, deploy, and host, using a tool I use nearly daily - git
.
Adding an item, compiling the list, and deploying, are accomplished with a single command:
git addItem -m "[URL]"
This single command adds a commit containing a message with the URL I want to share, then uses a combo of git
post-commit
hooks and other commands to build and deploy the reading list:
See below for more specifics on these commands and how to set them up. The result is a publicly available list of articles and associated thoughts.
First, DO NOT clone this repo. Cloning this repo will merely clone my reading list and not the underlying functionality. This reading list is created using a few simple git
commands.
To create your own git-based reading list, follow these steps:
- Create a new directory and init a repo:
mkdir reading-list
cd reading-list
git init
- Create a new repo on Github (or similar) and add it as a remote to your local repo, with:
git remote add origin https://github.com/user/repo.git
- Add a
git alias
for adding a new item, with:
git config alias.addItem "commit --allow-empty"
This allows us to perform a no-change commit.
- Add a
git alias
for building the reading list, with:
git config alias.build '!git --no-pager log --max-count=100 --grep="^http" --date=local --pretty=format:"%ad
[%s](%s)
%N
" > index.md'
This alias searches the git log
for commit messages starting with 'http' and writes them to the index.md
file.
- Add a
git alias
for deploying the reading list, with:
git config alias.deployList '!git add index.md && git commit -m "Update reading list" && git push origin master'
- Add a
post-commit
hook to rungit build
and push the changes to the remote. First open thepost-commit
hook file using your preferred editor, something like:
nano .git/hooks/post-commit
then add:
#!/bin/bash
commit_message=$(git log -1 --pretty="format:%s")
if [[ "$commit_message" == http* ]]; then
echo "New Item Added"
git build
git deployList
fi
exit 0
Save the file and exit.
- Make the
post-commit
hook executable, with:
chmod +x .git/hooks/post-commit
To add a new item to your reading list, use:
git addItem -m "YOUR-URL"
The post-commit
hook will detect the commit, compile the reading list, and push the changes to the remote repo.
Notes are added using the built-in git notes
. To add a note, after the git addItem
command, lookup the commit hash of the addItem
commit, and add a note with the following:
git notes add -m "YOUR NOTE" <COMMIT HASH>
git build
git deployList
git build
to compile the reading list. This will update the index.md
file with the latest changes.
If using Github, we can take advantage of Github Pages to make the reading list publicly available.
To enable the public reading list, go to your repo on Github, then Settings, and scroll to 'Github Pages'. Select the master
branch, and a theme if desired. Your reading list, the index.md
file, will now be available at https://[YOUR-GITHUB-USERNAME].github.io/[REPO-NAME]/