Skip to content
Ron DeVera edited this page Mar 5, 2014 · 6 revisions

Welcome to the Twig wiki! If you've written any useful Twig subcommands, feel free to share them here.

To use a subcommand:

  1. gem install twig && twig init
  2. Save the subcommand in your $PATH, e.g., ~/bin/.
  3. Make it executable: chmod +x ~/bin/twig-child-branches.

twig-child-branches

#!/usr/bin/env ruby

# Usage: `twig child-branches`
#
# Lists the child branches for the current branch.

current_branch = `git rev-parse --abbrev-ref HEAD`.strip
exec %{twig --only-diff-branch "#{current_branch}"}

twig-rebase-stack

#!/bin/sh

# Usage: `twig rebase-stack <root branch>`
#
# Rebase a linear stack of branches. Not for use with branch trees.
# Requires Twig 1.6 or later.

twig checkout-child 2> /dev/null
while [ $? -eq 0 ]; do
  twig rebase && twig checkout-child 2> /dev/null
done

echo "\nDone rebasing branch stack."
Clone this wiki locally