Re: Script to rebase branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 09, 2017 at 02:32:37PM +0200, Johannes Schindelin wrote:

> > I didn't really expect anybody to use it verbatim, though. I was
> > providing it more for inspiration.
> 
> I deem it part of Git's mission is to avoid forcing everybody to write
> scripts so specific to their own needs that they cannot be shared easily.

Sure. I'd be happy if somebody used it as inspiration to make a tool for
everybody, too.

The two main reasons I don't polish and try to share the bits in my
Meta/ more widely are:

  1. Most of them are as much policy as they are implementation logic.
     So either you buy in completely to the worldview that I've assumed
     in my tools, or you end up fighting the tool (and by the time you
     make the tool configurable enough to handle all world-views, you
     haven't really helped anybody).

     I think the best thing to do with those logic bits is to add them
     as much as possible to Git itself (e.g., as command-line options).
     That keeps any personal scripts as thin wrappers that specify the
     policy.

  2. Some of the features are really powerful but also really dangerous.
     For example, my "rebase" script (which rebases all my topics) and
     my "private" script (which builds my daily "private" version of Git
     to run) both write a shell snippet into $GIT_DIR/continue.

     And then I have a git-continue alias that looks like this:

        #!/bin/sh
        SUBDIRECTORY_OK=Yes
        . git-sh-setup
        cd_to_toplevel

        if test -f "$GIT_DIR/continue"; then
          eval "$(cat "$GIT_DIR/continue")"
        elif test -d "$GIT_DIR/rebase-merge"; then
          git rebase --continue
        elif test -d "$GIT_DIR/rebase-apply"; then
          if test -f "$GIT_DIR/rebase-apply/applying"; then
            git am --continue
          else
            git rebase --continue
          fi
        elif test -f "$GIT_DIR/CHERRY_PICK_HEAD"; then
          git cherry-pick --continue
        else
          echo >&2 "nothing to continue"
          exit 1
        fi

     So when I run "git continue" it magically tries to pick up the
     operation in progress keep going. When it works, it works
     beautifully. But when it doesn't...well, you can dig yourself into
     a pretty confusing situation. It's worth it for me, because I can
     dig myself out. But I'm not sure it's something I'd encourage other
     people to use.

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]