git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Martin von Zweigbergk <martinvonz@gmail.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>
Subject: Re: [PATCH 2/2] learn to pick/revert into unborn branch
Date: Sat, 22 Dec 2012 19:24:58 -0800	[thread overview]
Message-ID: <7vr4mhpi0l.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1356117013-20613-2-git-send-email-martinvonz@gmail.com> (Martin von Zweigbergk's message of "Fri, 21 Dec 2012 11:10:11 -0800")

Martin von Zweigbergk <martinvonz@gmail.com> writes:

>>From the user's point of view, it seems natural to think that
> cherry-picking into an unborn branch should work, so make it work,
> with or without --ff.

I actually am having a hard time imagining how that could ever be
natural.

When you are on an unborn branch, you may have some files in your
working tree, and some of them may even be registered to the index,
but the index is merely for your convenience to create your first
commit, and as far as the history is concered, it does not matter.

By definition you do not have any history in such a state.  What
does it even mean to "cherry-pick" another commit, especially
without the --no-commit option?  The resulting commit will carry the
message taken from the original commit, but does what it says match
what you have done?

I can understand that it may sometimes make sense to do

  $ git show --diff-filter=A $that_commit | git apply

as a way to further update the uncommitted state you have in the
working tree, so I can sort of buy that --no-commit case might make
some sense (but if you make a commit after "cherry-pick --no-commit",
you still get the log message from that commit, which does not
explain the other things you have in your working tree) in a limited
situation.

It seems to me that the only case that may make sense is to grab the
contents from an existing tree, which might be better served with

  $ git checkout $that_commit -- $these_paths_I_am_interested_in

> Cherry-picking anything other than a commit that only adds files, will
> naturally result in conflicts. Similarly, revert also works, but will
> result in conflicts unless the specified revision only deletes files.

You may be able to make it "work" for some definition of "work", but
I am not sure how useful it is.

Puzzled...

  reply	other threads:[~2012-12-23  3:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21 19:10 [PATCH 1/2] tests: move test_cmp_rev to test-lib-functions Martin von Zweigbergk
2012-12-21 19:10 ` [PATCH 2/2] learn to pick/revert into unborn branch Martin von Zweigbergk
2012-12-23  3:24   ` Junio C Hamano [this message]
2012-12-23  6:24     ` Martin von Zweigbergk
2012-12-23  7:01       ` Christian Couder
2012-12-23 19:20         ` Junio C Hamano
2012-12-23 20:27           ` Philip Oakley
2012-12-23 19:18       ` Junio C Hamano
2012-12-23 19:35         ` Junio C Hamano
2012-12-24  7:20         ` Martin von Zweigbergk
2012-12-23  4:02   ` Junio C Hamano

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=7vr4mhpi0l.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martinvonz@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.
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 NNTP newsgroup(s).