如何在eclipse使用git插件

how to commit file to remote?

--> Team
--> Synchronize Workspace
--> add to index
--> commit and push

how to revert the file to speic version

single file

-->show in History
-->select the version you want to revert
-->compare with workspace, compare the local and selected version
-->manage the diff and re commit the changes
# whole project
--> show in History
--> select the version you want to revert
--> Rest
--> select the reset Type
--> confirm,then the whole project will reset to the select version.

create new branch

--> developer should firstly check out their own branch,such as : luke-dev
--> developer must add code in their own branch:luke-dev
--> developer should merge there branch into dev branch after they finsh code in luke-dev.

merge branch: luke-dev --> dev

--> confirm all code commit and push to luke-dev
--> Team - merge - select dev - finish
--> there are 3 results for merage operation : Already-up-to-date, Fast-forward, Merged, Conflicting, Failed.

how to handler the conflict:

--> Team
--> Synchronize Workspace
--> double click the confict file
--> handler the conflict
--> re commit and but don't push the file
--> merge the local luke-dev to remote luke-dev
--> at last, pull code from server

create secrect and public Gist

使用场景

- 代替记事本记录简短代码段
- 给对方发送示例代码
- 使用 Gist 处理这类情况可以省去不少麻烦。

概念说明

index :暂缓区

HEAD Version??

file status

1)忽略[ ignored ]:仓库认为该文件不存在(如bin目录,不需要关注)。通过右键Team => Ignore 添加忽略文件

2)未跟踪[ untracked ]:仓库未跟踪,通常是新建的文件,要接入版本管理可以通过“Add to Index”或直接“Commit”操作。

3)已跟踪[ tracked ]:文件已被仓库记录。

4)已添加[ added ]:untracked 状态的文件,通过“Add to Index”被仓库已知,但是没有“Commit”,“Commit”后可变为“已跟踪[ tracked ]”状态。

5)已删除[ removed ]:从工作区中删除文件,文件会消失,也就没有图标出现,下一次提交时被删除。Team => Untrack可以触发本图标,在“Commit”对话框中可以看到图标。

6)已修改[ dirty ]: 修改“已跟踪[ tracked ]”的文件,未添加到暂存区Index(未“Add to Index”或“Commit”)的文件,标志与本地库不一致。

7)已暂存[ staged ]:修改“已跟踪[ tracked ]”的文件,并添加到暂存区Index(即执行“Add to Index”);

8)冲突[ conflict ] : 进行Marge合并操作会引起冲突,需要人工解决并添加到索引区修改状态。

9)已部分暂存[ partially-staged ]:修改“已跟踪[ tracked ]”的文件,部分修改已添加暂存区Index,部分未添加。
相当于:已跟踪的文件修改,Add to Index ,Commit前又修改了文件。

10)假设有效[ assume-valid ]:一些修改未被Git检查。右键Team => Assume unchanged可产生该状态。

Rest Type:

1)Soft:只回退commit信息(HEAD 指针),不回退暂存区(Index)和工作区(Working Directory 文件)源码,如果需要可再次提交,回到上次commit情况。

2)Mixed:回退commit信息(HEAD 指针)和暂存区(Index),只保留工作区(Working Directory 文件)源码。

3)Hard:所有更改都将恢复到所选分支/标记/Commit版本。工作区(Working Directory 文件)源码会变为上一个Commit版本的内容,未提交的更改都将丢失,因此该操作必须确认。

posted on 2018-12-05 09:30  lukelin1989  阅读(219)  评论(0)    收藏  举报

导航