This is a guest post from Jo Liss.
I picked up this trick to use Git as a kind of feed-reader on Moro’s blog, so I thought I’d share it here:
Let’s say you want to stay up-to-date with a project – for example, an upstream repository you are contributing to, a smart developer you are trying to learn from, or an awesome library you’d just like to watch. How do you go about following the commits that are being pushed?
You could use RSS feeds, such as the ones offered by GitHub:
But let’s be honest: We would much rather read commits and diffs in the shell, like we are used to. (And as a bonus, we won’t be assaulted by webcomics, pictures of kittens, and any number of other distractions our feed reader has in store for us.)
So instead, we display new commits with
git log, and use Git’s lightweight tag system to place a “ribbon” marker tag that keeps track of how far we have read.
Simply add the following code to your
[alias] ribbon = tag --force _ribbon origin/master catchup = log --patch --reverse --topo-order _ribbon..origin/master
Clone the project you want to watch, and type
git ribbon to initialize the ribbon marker.
Now whenever you fetch or pull, use
git catchup to read up on the latest changes in the
origin/master branch. After you are done reading, update the ribbon marker with
Sweet, isn’t it?
By the way: If you do not like to read the individual commits in topic branches that were merged into
origin/master, consider adding
--first-parent -m to the catchup log command.