Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Oneliner to convert svn:ignore into .gitignore
#!/bin/bash
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash
#!/bin/bash
svn propget -R svn:ignore | grep -v "^$" | sed "s/\(\(.*\) - \)\(.*\)/\2\/\3/g" | sort -u >> .gitignore
@sanjay-russmediatech

This comment has been minimized.

Copy link

sanjay-russmediatech commented Jul 27, 2017

really helpful

@svendhhh

This comment has been minimized.

Copy link

svendhhh commented Aug 11, 2017

Can I suggest adding a -u to the sort of svnignore2gitignore.sh to remove duplicates?
(I'm not sure why there'd be duplicates in the SVN ignore, or if could make sense there, but I'm pretty sure it doesn't make sense in .gitignore)?
I found out why I had duplicates. I had the "root" of the SVN project checked out, so was getting some entries for all branches/tags as well as root, and some duplicates that way... might not be any use to add the -u after all?

@iegik

This comment has been minimized.

Copy link
Owner Author

iegik commented Jun 22, 2018

@svendhhh Sure. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.