From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9D35491A for ; Fri, 29 Jul 2016 20:14:03 +0000 (UTC) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 108F4149 for ; Fri, 29 Jul 2016 20:14:01 +0000 (UTC) From: David Howells In-Reply-To: <1469815046.2330.13.camel@HansenPartnership.com> References: <1469815046.2330.13.camel@HansenPartnership.com> <20160729131151.GF4340@x> <20160729075039.GA26402@x> <30809.1469794812@warthog.procyon.org.uk> <1596.1469801212@warthog.procyon.org.uk> To: James Bottomley MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11640.1469823238.1@warthog.procyon.org.uk> Date: Fri, 29 Jul 2016 21:13:58 +0100 Message-ID: <11641.1469823238@warthog.procyon.org.uk> Cc: Christoph Lameter , "ksummit-discuss@lists.linuxfoundation.org" Subject: Re: [Ksummit-discuss] [ANNOUNCE] git-series: track changes to a patch series over time List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , James Bottomley wrote: > I do this too, but I also work with the diff when moving hunks. What I > do is: > > git checkout > git show > tmp.diff > vi tmp.diff so it only has the hunks I want to remove > patch -p1 -R < ~/tmp.diff > git commit --amend -a > git checkout > patch -p1 < ~/tmp.diff > git commit --amend -a > > It's a bit cumbersome, but you can script it. If there are better ways > to do it, I'm interested. One of the reasons I use stgit is when it comes to excising changes into a separate patch, it makes it a lot easier: stg show >tmp.diff # Export contents of current patch emacs tmp.diff # Edit so it only has the hunks I want to remove stg pop # Pop the patch I want to remove part of stg new foo # Create a new patch stg fold tmp.diff # ... and apply the patch created above emacs ... # Fix up any bits stg refresh # ... and make a commit out of it stg push # Push the patch I wanted to remove from The push at the end then attempts to modify the patch you previously popped so as to effect the excision. If it can't quite manage it, you'll get <<<<<<< and suchlike markers indicating the bit it had difficulty with. I can then very easily switch the order of the patches: stg float foo to put the excised patch last. I can also: stg pop # Pop the patch I want to remove part of stg new foo # Create a new patch emacs ... # Make the changes I want directly stg refresh # ... and make a commit out of it stg push # Reapply the previously popped patch. As before, the last line will attempt to modify the previously popped patch, and if it can't it will insert merge failure markers. David