[PATCH] Documentation/git-filter-branch: add a new commit-filter example

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

 



There is a commit-filter example already which skips commits but there is no
example on how to edit commit messages.

One can figure out this example by carefully reading the git-filter-branch and
git-commit-tree documentation but I think it isn't trivial so this example is
helpful.

Signed-off-by: Miklos Vajna <vmiklos@xxxxxxxxxxxxxx>
---

On Sat, Feb 23, 2008 at 11:45:28AM -0800, Junio C Hamano
<gitster@xxxxxxxxx> wrote:
> People who are not interested in git-svn at all may still want
> to fix up their commit log messages, and I think starting a
> paragraph with 'git-svn-blah' would risk them skipping it
> without reading (I certainly would).  Probably we would want to
> add a sentence before "To remove ...", like this:
>
>       You can rewrite the commit log messages using `--commit-filter`.
>       For example, `git-svn-id` strings in a repository created with
>       `git-svn` can be cleaned up this way:

second try follows :)

>
> > +------------------------------------------------------------------------------
> > +git filter-branch --commit-filter 'sed "/^git-svn-id:/d" |git
> > commit-tree "$@"'
> > +------------------------------------------------------------------------------
>
> Please try to keep them a bit shorter for reviewing pleasure on
> 80-column terminals after your message was quoted once or
> perhaps a few times.  The example is easier to read if you write
> like this, I think:
>
> ----------------------------------------------------------------
> git filter-branch --commit-filter '
>       sed -e "/^git-svn-id:/d" | git commit-tree "$@"
> '
> ----------------------------------------------------------------
>

ok. i used 72 in my mails and 80 in the code, but now i'm using 72 in
the code as well.

> I am not sure if git-svn people condone or encourage such
> removals, though.

i think it's only useful if you use git-svn for an svn -> git
conversion, provided that the project switches to git (there will be no
more svn commits and noone wants to push back git commits to svn).

 Documentation/git-filter-branch.txt |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
index e22dfa5..367064b 100644
--- a/Documentation/git-filter-branch.txt
+++ b/Documentation/git-filter-branch.txt
@@ -240,6 +240,15 @@ committed a merge between P1 and P2, it will be propagated properly
 and all children of the merge will become merge commits with P1,P2
 as their parents instead of the merge commit.
 
+You can rewrite the commit log messages using `--commit-filter`.  For
+example, `git-svn-id` strings in a repository created by `git-svn` can
+be removed this way:
+
+-------------------------------------------------------
+git filter-branch --commit-filter '
+	sed -e "/^git-svn-id:/d" | git commit-tree "$@"
+'
+-------------------------------------------------------
 
 To restrict rewriting to only part of the history, specify a revision
 range in addition to the new branch name.  The new branch name will
-- 
1.5.4.2

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

  Powered by Linux