git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Baumann <siprbaum@stud.informatik.uni-erlangen.de>
To: git@vger.kernel.org
Subject: Re: RFC: Patch editing
Date: Mon, 26 Feb 2007 14:18:14 +0100	[thread overview]
Message-ID: <slrneu5ngm.s8g.siprbaum@xp.machine.xx> (raw)
In-Reply-To: Pine.LNX.4.63.0702252156190.22628@wbgn013.biozentrum.uni-wuerzburg.de

Johannes Schindelin <Johannes.Schindelin@gmx.de> schrieb:
> Hi list,
>
> while I was hacking on another issue, I realized just how often I would 
> like to stash away a fix which is unrelated (but often triggered) by the 
> theme of the current topic branch. Or I fix an earlier commit, which is 
> not the tip of the branch, so I cannot --amend it.
>
> My common practice is to commit it nevertheless, and sort the topic 
> branches out later, by cherry-picking my way through the commits.
>
> This is a tedious and error-prone procedure, and I often wished I knew how 
> to use StGIT. But then, StGIT is overkill for me: on some machines I work 
> on, there is no Python installed, I do not really need to have a history 
> on the order and version of patches, and I do not need to preserve author 
> and committer information *1*.
>
> Therefore, I wrote this extremely simple script to sort out the order of 
> commits, and possibly merging some. The script lets you edit the commit 
> list upon start (reordering it, or removing commits), and then works on 
> that list. It has three subcommands:
>
> 	start <base>
> 	continue
> 	reset [-f]
>
> The subcommand "start" takes a base commit (actually, it will take the 
> merge base of HEAD and that base commit) from which to start. It builds a 
> commit list and opens it in an editor. The rows of the list have the form 
> "<action> <sha1> <oneline>". The oneline description is purely for ease of 
> use.
>
> The three possible actions are "pick" (the default), "edit" and "merge". 
> "pick" will just cherry-pick that commit, "edit" will stop after 
> cherry-picking so that you can make a small fixup (in the code or in the 
> commit message), and "merge" will try to apply the corresponding patch, 
> amend the previous commit with the result, and let you edit the combined 
> commit message.
>
> If a patch fails, or "edit" was specified, the loop is interrupted for 
> fixups. Use the subcommand "continue" to restart the loop (the working 
> tree has to be clean, though).
>
> Once there are no more commits to be picked, the original branch is 
> updated to that new tip.
>
> If you decide at some point that you do not want to rewrite the patches 
> after all, you can use the subcommand "reset".
>
> To see which commits were already applied, you can inspect .series/done, 
> and likewise .series/todo for what is to be applied yet. You can even edit 
> .series/todo if you decide on another course of action.
>
> Anyway, it is a relatively short and stupid script.
>

Nice.  I tried it on a simple testcase to just rearrange some commits
and it worked as expected. That was exactly what I was looking for!

I tried for a while stgit, but it seemed like overkill to me and I messed
up my test repo several times, propably because I have done something wrong
so I gave up.

-Peter

  reply	other threads:[~2007-02-26 13:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-25 21:59 RFC: Patch editing Johannes Schindelin
2007-02-26 13:18 ` Peter Baumann [this message]
2007-02-26 18:03 ` Shawn O. Pearce
2007-02-26 18:52   ` Johannes Schindelin
2007-02-26 18:56     ` Shawn O. Pearce
2007-02-26 19:51       ` Junio C Hamano
2007-02-27  7:14 ` Daniel Barkalow
2007-02-27 11:54   ` Johannes Schindelin
2007-02-27 17:35     ` Daniel Barkalow
2007-02-27 20:07       ` Johannes Schindelin
2007-02-27 22:07         ` Daniel Barkalow
2007-02-27 22:37           ` Johannes Schindelin
2007-02-28 10:13           ` Karl Hasselström
2007-03-01 23:30 ` Updated version, was " Johannes Schindelin
2007-03-01 23:59   ` 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=slrneu5ngm.s8g.siprbaum@xp.machine.xx \
    --to=siprbaum@stud.informatik.uni-erlangen.de \
    --cc=git@vger.kernel.org \
    /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).