# Remove leading/trailing whitespace from commit messages when importing from Subversion?

3 messages from 2009-03-10 to 2009-03-10. Participants: Mike Swanson, Marcel M. Cary.
Thread: https://gitlist.dev/t/18244

## Mike Swanson, 2009-03-10 03:14

Subject: Remove leading/trailing whitespace from commit messages when importing from Subversion?
Message-ID: <49B5DB01.8080206@gmail.com>
URL: https://gitlist.dev/e/49B5DB01.8080206%40gmail.com

```
I was wondering if it's possible to removing leading and trailing
whitespace (tabs, newlines, spaces) from commit messages when importing
from Subversion via git-svn.

I've got a repository with tens of thousands of commits, and not all of
the messages are entered... sanely.  I need to know whether it is
possible to clean these up when transfering the repository to Git.


Thanks.

```

## Marcel M. Cary, 2009-03-10 05:38

Subject: Re: Remove leading/trailing whitespace from commit messages when importing from Subversion?
Message-ID: <49B5FCD3.8060707@oak.homeunix.org>
URL: https://gitlist.dev/e/49B5FCD3.8060707%40oak.homeunix.org
In-Reply-To: <49B5DB01.8080206@gmail.com>

```
Mike Swanson wrote:
> I was wondering if it's possible to removing leading and trailing
> whitespace (tabs, newlines, spaces) from commit messages when importing
> from Subversion via git-svn.
> 
> I've got a repository with tens of thousands of commits, and not all of
> the messages are entered... sanely.  I need to know whether it is
> possible to clean these up when transfering the repository to Git.

Try "git filter-branch --msg-filter your-filter-command".

Marcel

```

## Mike Swanson, 2009-03-10 06:15

Subject: Re: Remove leading/trailing whitespace from commit messages when importing from Subversion?
Message-ID: <49B6057E.2020706@gmail.com>
URL: https://gitlist.dev/e/49B6057E.2020706%40gmail.com
In-Reply-To: <49B5FCD3.8060707@oak.homeunix.org>

```
Marcel M. Cary wrote:
> Try "git filter-branch --msg-filter your-filter-command".
>
> Marcel
>   

Thank you, after-the-fact works fine too.  :)

If anyone else searches the archives and wonders how I did it, this sed
command is it: sed -e "s/^[ \t]*//;s/[ \t]*$//;/^$/d"

Unix rules!

```
