From: Jeff King Date: Wed, 19 Oct 2016 22:42:11 GMT Subject: Re: tools for easily "uncommitting" parts of a patch I just commited? Message-ID: <20161019224211.k4anavgqrhmunz6p@sigill.intra.peff.net> In-Reply-To: On Wed, Oct 19, 2016 at 03:26:18PM -0700, Jacob Keller wrote: > I recently (and in the past) had an issue where I was using git add > --interactive and accidentally did something like the following: > > # hack lots of randmo changes, then begin trying to commit then separately > git add -i > # set only the changes I want > # accidentally add to the commit > $git commit -s > # type up a long commit message > # notice that I committed everything > > At this point I'd like to be able to do something like: > $git unstage -i > # select each hunk to unstage I'd usually do one of: # undo selectively git reset -p HEAD^ git commit --amend or: # roll back the whole commit git reset HEAD # do it right this time git add -p # and steal the commit message from the previous attempt git commit -c HEAD@{1} -Peff