Skip to content

brettdewoody/reading-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Reading List

This is my developer reading list - recent articles and books I've read, with occasional thoughts.

View my full reading list.

How it Works

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.

Create Your Own Reading List

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:

  1. Create a new directory and init a repo:
mkdir reading-list
cd reading-list
git init
  1. 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
  1. 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.

  1. 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.

  1. 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'
  1. Add a post-commit hook to run git build and push the changes to the remote. First open the post-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.

  1. Make the post-commit hook executable, with:
chmod +x .git/hooks/post-commit

And You're Ready To Go

Add a new item

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.

Add a note to an item

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

Build the reading list

git build

to compile the reading list. This will update the index.md file with the latest changes.

Making the Reading List Public

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]/

About

My recent dev-related reads, with occasional thoughts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published