git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Ping Yin <pkufranky@gmail.com>
Cc: git mailing list <git@vger.kernel.org>
Subject: Re: A question about using 'add -p' to split the patch
Date: Sun, 14 Jun 2009 23:12:12 -0700	[thread overview]
Message-ID: <20090615061211.GA53136@gmail.com> (raw)
In-Reply-To: <46dff0320906142008v4f278d3ek3eebfa36f7fcf06a@mail.gmail.com>

On Mon, Jun 15, 2009 at 11:08:51AM +0800, Ping Yin wrote:
> file bt.php in the HEAD:
> 
> function bt_add($path) {
>  return;
> }
> 
> file bt.php in the working directory:
> 
> function bt_move($path, $pos) {
>   return;
> }
> function bt_add($path, $pos) {
>   bt_move($path, $pos)
>   return;
> }
> 
> Now i want to split the change into two parts:
> First introduce bt_move
> Then add a param pos to bt_add and call bt_move
> 
> With the 'e' action of 'add -p', i got
> 
> -function bt_add($path) {
> +function bt_move($path, $pos) {
> +  return;
> +}
> +function bt_add($path, $pos) {
> +  bt_move($path, $pos)
>    return;
>  }
> 
> Then, i want to edit the patch to get
> 
> 
> function bt_move($path, $pos) {
>   return;
> }
> function bt_add($path) {
>   return;
> }
> 
> However, whatever i do, the patch fails to apply. Any suggestion?

Use git-gui or git-cola to select just bt_move() for addition.
You can stage specific lines.

After doing that it's often a good idea to git stash --keep-index
so you can test it before committing.

enjoy,

-- 
		David

  reply	other threads:[~2009-06-15  6:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15  3:08 A question about using 'add -p' to split the patch Ping Yin
2009-06-15  6:12 ` David Aguilar [this message]
2009-06-15  6:24   ` Ping Yin
2009-06-15  7:36     ` David Aguilar
2009-06-15  8:56       ` Ping Yin

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=20090615061211.GA53136@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pkufranky@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).