Hi, Jan Nieuwenhuizen wrote: > As discussed previously > > http://kerneltrap.org/mailarchive/git/2008/8/13/2925144 > > Change a topgit branch's dependencies by doing a rebase-by-merge. > > Signed-off-by: Jan Nieuwenhuizen <janneke@xxxxxxx> > --- > Makefile | 2 +- > README | 5 ++ > tg-redepend.sh | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 160 insertions(+), 1 deletions(-) > create mode 100644 tg-redepend.sh [...] > + -h|--help) > + echo "Usage: tg [--add|--remove] DEPENDENCY..." >&2 s/tg/tg redepend/? [...] > +# Create new base B' -- does not have to be a topgit branch, but that's easiest > +if [ -z "$restarted" ]; then > + git branch -D $p_ > /dev/null 2>&1 || : > + > + tg create $b_ $redeps Why not move the base-creation code in tg-create.sh to a new function in tg.sh to use here? [...] > +if [ "$restarted" != "merge" ]; then > + git checkout $(git rev-parse $p) > + if ! git merge --no-ff --no-commit $b_; then > + touch "$git_dir/top-merge" > + fail merge > + fi [snip continuing-a-merge case] > +fi > +git read-tree -m -u $(git rev-parse $p_) [snip topdeps juggling] > +git commit -m "Rebased-using-merge onto new dependencies: $redeps." > /dev/null 2>&1 I know I suggested that code before, but the merge with B' is wasted, so perhaps git checkout P head=$(git rev-parse --verify HEAD^0) result_tree=$(git log -1 --pretty=format:%T P') result_commit=$(git commit-tree "$result_tree" -p P -p B') git update-ref -m "commit (merge): tg-redepend" HEAD \ "$result_commit" "$head" || ... (fail) test -x "$GIT_DIR/hooks/post-merge" && $GIT_DIR/hooks/post-merge 0 I'm not sure. Is there some more porcelain-ish way to do this (create a merge commit when you already know the resulting and parents)? But with that change the entire restarted=merge branch would go away, so I hope there is a nice way to do it. I'll think more. Hope that helps, Jonathan > + > +git branch -f $p > +git checkout $p > + > +tg delete $b_ > /dev/null 2>&1 > +git branch -D $p_ > + > +info "Rebased-using-merge onto new dependencies: $redeps." > + > +# Local Variables: > +# sh-basic-offset:8 > +# End: > -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html