git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Lars Schneider <larsxschneider@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Script to rebase branches
Date: Wed, 10 May 2017 00:46:45 -0400	[thread overview]
Message-ID: <20170510044645.hqxkzljajaifwwsl@sigill.intra.peff.net> (raw)
In-Reply-To: <alpine.DEB.2.21.1.1705091418540.146734@virtualbox>

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

  reply	other threads:[~2017-05-10  4:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-06 10:23 Script to rebase branches Lars Schneider
2017-05-06 17:14 ` Dennis Kaarsemaker
2017-05-09  4:09 ` Jeff King
2017-05-09 10:50   ` Johannes Schindelin
2017-05-09 11:02     ` Jeff King
2017-05-09 12:32       ` Johannes Schindelin
2017-05-10  4:46         ` Jeff King [this message]
2017-05-09 22:47       ` Junio C Hamano
2017-05-10  4:36         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170510044645.hqxkzljajaifwwsl@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=larsxschneider@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).