Skip to contentSkip to conversation

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

DISCUSSION Mike Swanson 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 7 lines · Mike Swanson

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

#2 lore raw
Quoted 4 lines · Marcel M. Cary

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!