Skip to content

Instantly share code, notes, and snippets.

@alx
alx / git.rb
Created December 6, 2010 14:24
Jekyll plugin to add Git activity inside a list
require 'git'
module Jekyll
class GitActivityTag < Liquid::Tag
def initialize(tag_name, text, tokens)
super
end
def render(context)
[alias]
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m \"wip\""
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
rb = !"git wip;git rebase -i origin/master;git unwip"
pr = !"git fetch;git wip;git rebase --stat origin;git unwip;git heads"
head = !"git log -n1"
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'"
heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'"