Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [ITCH] pull.default
Date: Mon, 18 Mar 2013 11:57:35 -0700	[thread overview]
Message-ID: <7vy5dkmt7k.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CALkWK0nT9hE_kRt3DLXfP45OwCSLurMOzuTqepxhkWjagbFDUQ@mail.gmail.com> (Ramkumar Ramachandra's message of "Tue, 19 Mar 2013 00:09:37 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> I usually use `git fetch`, inspect state, and then merge/ rebase
> accordingly.  Unfortunately, this is very sub-optimal as I can
> automate this 80% of the time.  I want to be able to decide what to do
> on a repository-specific basis, and hence propose a pull.default which
> can be set to the following:
> 1. fetch.  Just fetch.  (I will set this as my default in ~/.gitconfig)
> 2. fast-forward.  Fetch.  If the FETCH_HEAD is directly ahead of HEAD,
> `stash`, merge, and stash apply.  Otherwise, do nothing.
> 3. rebase.  Fetch.  stash, rebase, stash apply. `git pull n` will do
> rebase --onto master HEAD~n instead of rebase.
> 4. reset.  Fetch, stash, reset --hard FETCH_HEAD, stash apply.
>
> Ofcourse, it should print a message saying what it did at the end.
>
> What do you think?

Many other possibilities are missing.  "fetch and merge", for
example.

You seem to be generalizing the "--rebase" and "--ff-only" options
of "git pull" with 2 and 3, which may (or may not) make sense.

I think you can shrink and enhance the above repertoire at the same
time by separating "do I want to have stash and stash pop around"
bit into an orthogonal axis.  The other orthogonal axes are "Under
what condition do I integrate the work from the upstream?" (e.g.
"only when I do not have anything, aka, ff-only") and "How would I
integrate the work from the upstream?" (e.g. "rebase my work" and
"discard anything I did aka reset --hard").

By the way, I do not think you should start your design from a
configuration (this is a general principle, not limited to this
case).  Think about what the smallest number of independent options
you need to add to express various workflows, and then turn them
into configuration variables that can set the default, all of which
have to be overridable from the command line.

  reply	other threads:[~2013-03-18 18:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 18:39 [ITCH] pull.default Ramkumar Ramachandra
2013-03-18 18:57 ` Junio C Hamano [this message]
2013-03-18 19:21   ` Ramkumar Ramachandra
2013-04-13 21:54   ` Ramkumar Ramachandra

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

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

  git send-email \
    --in-reply-to=7vy5dkmt7k.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox