Intellij IDEA svn的使用笔记

随着时间的推移,Intelliij IDEA异军突起,使用率得到了极大的提升,相比eclipse,性能毋庸置疑。svn是web项目的管理利器,本文就是阐述如何在IDEA上使用svn的,找回当初那个感觉。

转载自:http://www.cnblogs.com/whc321/p/5669804.html

这里的忽略一直灰色的,可以进入

这里的版本控制里进行忽略选择

或者

这里进行添加

这里有三个选择

按照顺序

1、忽略指定的文件

2、忽略文件夹下所有文件

3、忽略符合匹配规则的文件

 

到Commit Changes 这里有几个选项需要了解的:

 

Auto-update after commit :自动升级后提交

keep files locked :把文件锁上,我想这应该就只能你修改其他开发人不能修改不了的功能

在你提交之前:before commit

Reformat code:重新格式化代码

Rearrange code:重新整理代码

Optimize imports:优化导入

Perform code analysis:执行代码分析[ 默认选择]

Check TODO(show all):检测需要修改的代码[显示所有默认选择]

clean up: 清除所有

Update copyright:更新版权

id="iframe_0.18304073111970087" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112004363.jpg?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.18304073111970087',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 725px; height: 605px;">

具体看情况选择功能点:比如不想其他人修改这些代码可以选择keep files locked

在Commit Message 添加修改信息

id="iframe_0.7069416403176141" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112004364.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7069416403176141',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 453px; height: 260px;">

修改成功:

id="iframe_0.4955541994328494" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112004365.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4955541994328494',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 483px; height: 25px;">

在commit 按钮下面还有一个是create patch这个选项试一下其作用:

id="iframe_0.4876561376558326" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112005366.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4876561376558326',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 728px; height: 434px;">

应该明白是创建一个补丁文件主要的作用就是可以查看修改的地方:

id="iframe_0.971546884617041" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112005367.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.971546884617041',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 705px; height: 551px;">

三、Android Studio SVN代码冲突的解决

关于代码冲突解决的问题,首先要感谢一下知友ShinChven的回答建议。在使用SVN更新服务器上的代码时,有时会弹出代码冲突的对话框,问你是否进行合并,并提供了三种合并方案:accept yours(使用你的)、accept theirs(使用别人的)和merge(合并);
id="iframe_0.246081981019886" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/2015/0821/20150821100408350.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.246081981019886',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 600px; height: 528px;">

前两个都是进行的覆盖操作,就不多做解释了;当你选择merge合并时,会弹出代码合并对照窗口,一共有三个屏,左右两侧时你和服务器不同的代码并高亮显示不同的部分,带有箭头和叉号,通过点击箭头将两边冲突的代码添加到中间的合并区域中去,点击叉号则辨识放弃那一段代码,待所有冲突处理完成后merge就成功了。

id="iframe_0.3356916234384446" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/2015/0821/20150821100408615.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.3356916234384446',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 600px; height: 471px;">


当然在使用过程中肯定会遇到很多的问题上面的东西也是参考其他大神的,自己也添加了几点区别:到时候遇到问题再继续研究下。
继续完善:

Checkout SVN上的项目

选择subversion

id="iframe_0.6777891749258904" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112005368.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6777891749258904',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 516px; height: 476px;">

 

导入项目到SVN服务器,

Import into 选择subversion

id="iframe_0.2684059372074372" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112005369.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.2684059372074372',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 848px; height: 384px;">

 

 

 

点击  id="iframe_0.88729068056539" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112005370.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.88729068056539',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 27px; height: 32px;">添加服务地址例如

id="iframe_0.9557806214917448" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112007371.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.9557806214917448',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 340px; height: 432px;">


浏览SVN服务器上的项目文件夹

id="iframe_0.5922933530302541" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112009373.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5922933530302541',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 587px; height: 460px;">

SVN仓库会显示文件列表

id="iframe_0.4395645101557728" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112010374.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4395645101557728',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 848px; height: 369px;">

 

其他说明

id="iframe_0.0486840254923" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112012377.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.0486840254923',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 486px; height: 572px;">

 

单文件 签入当文件,右键subversion Add

文件红色:表示文件没有添加到服务器

绿色:表示没有更新新的修改到服务器

普通黑色:表示和服务器同步

文件夹颜色说明

id="iframe_0.9417297666069415" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112012379.jpg?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.9417297666069415',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 104px; height: 145px;">

参考 :http://blog.csdn.net/niu_hao/article/details/6774471

黄色感叹号(有冲突): --这是有冲突了,冲突就是说你对某个文件进行了修改,别人也对这个文件进行了修改,别人抢在你提交之前先提交了,这时你再提交就会被提示发生冲突,而不 允许你提交,防止你的提交覆盖了别人的修改。要解决冲突,如果你确认你的修改是无效的,则用TSVN还原你的修改就行了;如果认为你的修改是正确的,别人 的提交是无效的,那么用TSVN先标记为“解决冲突”,然后就可以提交了;如果你认为你的修改和别人的修改都有一部分是有效的,那么你就把别人的修改手动 合并到你的修改中,然后使用TSVN标注为“解决冲突”,然后就可以提交了。进入文件夹,寻找有黄色感叹号的文件,这些文件就是发生冲突的地方,根据实际 情况处理冲突 米字号(有本地修改代码): --这是说明你有未提交的本地代码。 问好(新加入的资源): --这说明该文件是项目中新增文件资源,新增资源可以是文件、图片、代码等。

红色感叹号(本地代码与库没有保持一致): --这说明本地代码跟库上没有保持一致,如果用户想修复,可以将带红色感叹号图标文件删除,直接update即可。 灰色向右箭头(本地修改过) --本地代码没有及时上库。 蓝色向左箭头(SVN上修改过) --记得更新代码后修改,提交前跟svn对比习惯。 灰色向右且中间有个加号的箭头(本地比SVN上多出的文件) --修改完记得跟svn保持一致 蓝色向左且中间有个加号的箭头(SVN上比本地多出的文件) --删除该文件后,再次更新,将svn上文件全部更新下来。 灰色向右且中间有个减号的箭头(本地删除了,而SVN上未删除的文件) --也就是说你删除确认后,一定要记得上库,跟svn保持一致 蓝色向左且中间有个减号的箭头(SVN上删除了,而本地未删除的文件) --比对svn库上代码,确定需要删除后,更新svn(删除无用代码)。 红色双向箭头(SVN上修改过,本地也修改过的文件 ) --这个表示本地和svn上都修改过,最好就是把本地修改合并到svn,修改代码前最后先更新。

 

文件状态说明:

id="iframe_0.5490446937220794" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112013381.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5490446937220794',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 699px; height: 432px;">

 

单个文件签入签出操作:右键subversion

Add,添加到服务器

Commit:提交

Update:更新,获取新版本

Integrate:合并

注意:SVN和VSS不同签入前如果文件被其他人修改需要比较版本如何其他修改有效需要合并签入

id="iframe_0.39898566463055585" src="data:text/html;charset=utf8,%3Cimg%20id=%22img%22%20src=%22http://www.it165.net/uploadfile/files/2015/0821/20150821112013383.png?_=5669804%22%20style=%22border:none;max-width:848px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.39898566463055585',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" frameborder="0" scrolling="no" style="margin: 0px; padding: 0px; border-width: initial; border-style: none; width: 824px; height: 884px;">

整个项目更新提交:Commit ,Update


不知道是啥原因如果刚刚开始选择share project(subvision)的话,好像在选择commit的时候很慢,始终上传不了绿色的部分代码:

所以我直接在本地:commit到服务器里面的



  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值