svn方便的方式将本地项目推送到远程仓库

时间:2015-12-30 09:53:17

标签: svn

我在本地创建了一个演示项目,现在我想把它推到svn repo。以下是我实现此目的的操作。

#push to remote repo
svn import  /home/foo/workspace/bar/spring-boot-demo \
https://svn.foo.com/svn/server/samples/spring-boot-demo/ \
-m "Initial import"
#found /home/foo/workspace/bar/spring-boot-demo does not to become a working copy automatically So I have to check it out 
svn checkout https://svn.foo.com/svn/server/samples/spring-boot-demo/

#then delete those files wanted to ignore
svn delete .classpath --keep-local
svn delete .settings --keep-local
svn delete .project --keep-local
svn delete target --keep-local

#then create .svnignore to include these ignored files and execute svn ignore
svn propset svn:ignore -F .svnignore .
#commit again
svn commit

你可以看到它很麻烦,确实存在一些方便的方式来实现这一点吗?在git中,您只需创建一个.gitignore,然后执行git push即可。

1 个答案:

答案 0 :(得分:0)

通过咨询经验的同事,他告诉我可以这样做:

#create a remote repo first
$ svn mkdir https://svn.foo.com/svn/server/samples/spring-boot-demo
$ svn co https://svn.foo.com/svn/server/samples/spring-boot-demo
Checked out revision 15667.
$ cd sprin-boot-demo
$ vim .svnignore
.classpath
.project
.settings
target
$ svn propset svn:ignore -F .svnignore .
property 'svn:ignore' set on '.'

$ cp -r ../demo/* spring-boot-demo/
$ svn add . --force
$ svn commit