4.1 Git插件
Eclipse中已经内置了Git插件

4.2 把工程初始化为本地库
初始化

设置本地库范围的签名

4.3 Git图标

4.4 Eclipse特定文件
Eclispe特定文件介绍

为何要忽略特定文件
不同IDE相关工程特定文件就有可能不同。如果这些文件加入版本控制,那么开发时很有可能需要为了这些文件解决冲突。

GitHub官网忽略文件样例
https://github.com/github/gitignore
https://github.com/github/gitignore/blob/master/Java.gitignore

配置自己的忽略文件java.gitignore
注:该忽略文件最好与git全局配置文件放同一级,即家目录下

在git全局配置文件.gitconfig中加入忽略文件配置

忽略特定文件后

4.5 Eclipse中本地库相关操作
追踪或暂存

提交

4.6 Eclipse中远程库操作
push操作

clone操作
import...导入工程 => Git/Projects from Git => Clone URI
注意:clone下来的项目在configure中转换为对应的Java项目

4.7 在Eclipse中解决冲突
制造一个冲突
将GitTest项目与GitTest1项目中的GitTest.java修改相同行,并提交到各自的本地库。
两个本地库对应的是同一个远程库,即先push的能接受,后push的会冲突。

图形化界面解决冲突与提交
