build_cmd="bin/build_next"
 
 no_build=false
+start_from=""
+
 [ "$1" = "-n" ] && {
        shift
        no_build=true
 }
+[ "$1" = "-s" ] && {
+       shift
+       start_from="$1"
+       [ -z "$start_from" ] && {
+               echo "-s requires a start tree" 1>&2
+               exit 1
+       }
+       shift
+}
 [ -n "$1" ] && build_host="$1"
 
-cp /dev/null $LOG_FILE
-
 log()
 {
        echo "$@" | tee -a $LOG_FILE
        return ${PIPESTATUS[0]}
 }
 
-execute git checkout master
-execute git reset --hard stable
+[ -n "$start_from" ] || {
+       cp /dev/null $LOG_FILE
+       execute git checkout master
+       execute git reset --hard stable
+}
 
 heads=$(grep -v '^#' ../real_control | awk -F '        ' '$2=="quilt" { printf("quilt/%s ", $3); } $2=="git" { printf("%s/%s ", $3, $5); }')
 
 for h in $heads; do
        tree=${h%/*}
        [ "$tree" == "quilt" ] && tree=${h#quilt/}
+
+       [ -n "$start_from" ] && {
+               if [ "$tree" = "$start_from" ]; then
+                       start_from=""
+               else
+                       continue
+               fi
+       }
+
        log Merging $h
        old_head=$(git rev-parse HEAD)
        execute git merge $h || {