Re: A question about using 'add -p' to split the patch

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

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]