文件夹文件变化怎么同步到idea
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了文件夹文件变化怎么同步到idea相关的知识,希望对你有一定的参考价值。
参考技术A idea⾃动同步⽂件本地内容设置刚开始从eclipse转到idea,发现idea从svn同步代码后,点开⼀个java类报错 说是某个⽅法不存在,以为是别⼈代码没有提全,就点到别⼈代码⾥⾯去看,顶⾏出现
“File was changed on disk --------------Reload”,说是⽂件已经在磁盘修改了,需要重新加载,点⼀下reload 就好了,
为啥不能⾃动同步代码喃,要是svn更新了⼀堆⽂件,还得⼀个⼀个⼿动同步,就去找设置,找了半天终于找到了,有个⾃动 同步的设置,File->setting->Appearance&behavior->synchronize files on frame or editor tab activation,勾上就OK了
¥
5
百度文库VIP限时优惠现在开通,立享6亿+VIP内容
立即获取
idea自动同步文件本地内容设置
idea⾃动同步⽂件本地内容设置
刚开始从eclipse转到idea,发现idea从svn同步代码后,点开⼀个java类报错 说是某个⽅法不存在,以为是别⼈代码没有提全,就点到别⼈代码⾥⾯去看,顶⾏出现
“File was changed on disk --------------Reload”,说是⽂件已经在磁盘修改了,需要重新加载,点⼀下reload 就好了
git 如何去解决冲突
1、工程->Team->同步:2、从远程pull至本地,就会出现如下内容:
3、使用Merge Tool,执行第二项
4、再手动修改
4、修改后的文件需要添加到Git index中去:
5、冲突文件变为修改图标样式,再提交至本地,此时的提交便是merge合并:
6、此时需要pull的向下箭头和数量没了,注意图标的变化:
7、现在可以直接push到远程了:
此时configure->save and push一步步执行冲突就搞定了。 参考技术A 1、工程->Team->同步:
2、从远程pull至本地,就会出现如下内容:
3、使用Merge Tool,执行第二项
4、再手动修改
4、修改后的文件需要添加到Git index中去:
5、冲突文件变为修改图标样式,再提交至本地,此时的提交便是merge合并:
6、此时需要pull的向下箭头和数量没了,注意图标的变化:
7、现在可以直接push到远程了:
此时configure->save and push一步步执行冲突就搞定了。 参考技术B git冲突的场景与其他SCM工具一样,我在这边修改了文件a,同事也修改了文件a。同事比我先提交到仓库中,那么我pull代码时就会报错:
$ git pull
remote: Counting objects: 39, done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 39 (delta 13), reused 0 (delta 0)
Unpacking objects: 100% (39/39), done.
From https://code.csdn.net/lincyang/androidwidgetdemo
d3b2814..5578b8c master -> origin/master
Updating d3b2814..5578b8c
error: Your local changes to the following files would be overwritten by merge:
app/src/main/AndroidManifest.xml
app/src/main/java/com/linc/skill/screenswitch/ScreenSwichActivity.java
Please, commit your changes or stash them before you can merge.
Aborting
1234567891011121314
而此时我又不顾这个错误,将我的代码add并commit,然后push时报如下错:
To https://code.csdn.net/lincyang/androidwidgetdemo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://code.csdn.net/lincyang/androidwidgetdemo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
12345678
然后我有执行了git pull:
$ git pull
Auto-merging app/src/main/java/com/linc/skill/screenswitch/ScreenSwichActivity.java
CONFLICT (content): Merge conflict in app/src/main/java/com/linc/skill/screenswitch/ScreenSwichActivity.java
Auto-merging app/src/main/AndroidManifest.xml
CONFLICT (content): Merge conflict in app/src/main/AndroidManifest.xml
Automatic merge failed; fix conflicts and then commit the result.123456
那么既然两个文件冲突,我就可以借助mergetool来搞定它。我安装了meld作为代码比对工具,那么它理所当然也就成为我的mergetool了。
$ git mergetool
This message is displayed because 'merge.tool' is not configured.
See 'git mergetool --tool-help' or 'git help config' for more details.
'git mergetool' will now attempt to use one of the following tools:
meld opendiff kdiff3 tkdiff xxdiff tortoisemerge gvimdiff diffuse diffmerge ecmerge p4merge araxis bc3 codecompare emerge vimdiff
Merging:
app/src/main/AndroidManifest.xml
app/src/main/java/com/linc/skill/screenswitch/ScreenSwichActivity.java
Normal merge conflict for 'app/src/main/AndroidManifest.xml':
local: modified file
remote: modified file
Hit return to start merge resolution tool (meld):
Normal merge conflict for 'app/src/main/java/com/linc/skill/screenswitch/ScreenSwichActivity.java':
local: modified file
remote: modified file
Hit return to start merge resolution tool (meld):
1234567891011121314151617181920
merge完成后,执行git status发现有些文件做了修改,那么把这些文件提交 吧,就把这次commit作为一次merge操作吧。
$ git commit -m "merge"
[master 978aa1f] merge
$ git push
Counting objects: 64, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (25/25), done.
Writing objects: 100% (33/33), 3.81 KiB | 0 bytes/s, done.
Total 33 (delta 15), reused 0 (delta 0)
To https://code.csdn.net/lincyang/androidwidgetdemo.git
5578b8c..978aa1f master -> master
$ git pull
Already up-to-date.123456789101112
至此,本次冲突解决完毕。
如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:
git stash
git pull
git stash pop
以上是关于文件夹文件变化怎么同步到idea的主要内容,如果未能解决你的问题,请参考以下文章
IntelliJ IDEA 怎么热部署,每次修改java文件就得重启tomcat