Skip to content

Instantly share code, notes, and snippets.

@lesstif
Created June 22, 2017 06:09
Show Gist options
  • Save lesstif/b987bc94fcf3271749e18cd33a092501 to your computer and use it in GitHub Desktop.
Save lesstif/b987bc94fcf3271749e18cd33a092501 to your computer and use it in GitHub Desktop.
svn2git migration script
#!/bin/sh
## svn project
PRJS="test test2 test"
## svn repository root
SVN_ROOT=https://you-svn.examepl.com/svn/
## git ignore list
IGNORE="vim,java,maven,linux,eclipse,windows,intellij"
## download gitignore
curl -k "https://www.gitignore.io/api/${IGNORE}" > gitignore
## loop
for p in ${PRJS};do
# echo ${SVN_ROOT}/${[};
## cleaning legacy workspace
rm -rf ${p};
mkdir -p ${p};
## download gitignore
cp gitignore ${p}/.gitignore;
## running svn2git
cd ${p}
## PASSWD is svn login password, USERNAME is login id
yes PASSWD | svn2git -v ${SVN_ROOT}/${p} \
--username USERNAME --rootistrunk
## add git ignore
git add .gitignore
### repeat
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment