作者:Pillar
1、GitHub官网创建仓库并找到克隆的仓库地址,如:
https://github.com/PillarChen/MyFirstGit.git
![](http://static.oschina.net/uploads/img/201601/25182308_6sye.jpg)
![](http://static.oschina.net/uploads/img/201601/25182308_Btyg.jpg)
![](http://static.oschina.net/uploads/img/201601/25182308_6kmE.jpg)
2、打开SmartGit克隆仓库
![](http://static.oschina.net/uploads/img/201601/25182309_mMSW.jpg)
![](http://static.oschina.net/uploads/img/201601/25182309_0yLd.jpg)
![](http://static.oschina.net/uploads/img/201601/25182310_sRZm.jpg)
![](http://static.oschina.net/uploads/img/201601/25182310_Q8oF.jpg)
![](http://static.oschina.net/uploads/img/201601/25182310_awpF.jpg)
![](http://static.oschina.net/uploads/img/201601/25182311_dHuq.jpg)
3、将SmartGit开发工作切换到Develop分支上(配置完成后双击Branches中的develop):
![](http://static.oschina.net/uploads/img/201601/25182311_Ux45.jpg)
![](http://static.oschina.net/uploads/img/201601/25182312_NnO7.jpg)
![](http://static.oschina.net/uploads/img/201601/25182312_evRw.jpg)
![](http://static.oschina.net/uploads/img/201601/25182313_Fm8O.jpg)
开发时处于的状态:
![](http://static.oschina.net/uploads/img/201601/25182313_3qwZ.jpg)
4、查看日志:
![](http://static.oschina.net/uploads/img/201601/25182313_bmMO.jpg)
![](http://static.oschina.net/uploads/img/201601/25182314_r98T.jpg)
5、项目更改向GitHub中更新代码:
![](http://static.oschina.net/uploads/img/201601/25182314_khw3.jpg)
![](http://static.oschina.net/uploads/img/201601/25182314_G5ks.jpg)
![](http://static.oschina.net/uploads/img/201601/25182315_btAD.jpg)
第一步:Stage(将本地电脑克隆位置的仓库中文件的改变保存到本地仓库中)
![](http://static.oschina.net/uploads/img/201601/25182315_CZdI.jpg)
![](http://static.oschina.net/uploads/img/201601/25182315_TD8s.jpg)
第二步:Commit(提交提示信息)
![](http://static.oschina.net/uploads/img/201601/25182316_8W82.jpg)
![](http://static.oschina.net/uploads/img/201601/25182316_ZVuh.jpg)
第三步:Pull(将GitHub远程仓库中的代码更新到本地仓库中,对比是否出现冲突,出现则解决后在执行第二步和第三步)
![](http://static.oschina.net/uploads/img/201601/25182317_0Hod.jpg)
![](http://static.oschina.net/uploads/img/201601/25182317_gczh.jpg)
第四步:Push(将更新的代码推送到GitHub远程仓库中)
![](http://static.oschina.net/uploads/img/201601/25182318_nu7I.jpg)
![](http://static.oschina.net/uploads/img/201601/25182318_yieL.jpg)
若是设置了密码,则输入:
![](http://static.oschina.net/uploads/img/201601/25182318_wlXT.jpg)
查看日志可以看到向GitHub中提交代码成功:
![](http://static.oschina.net/uploads/img/201601/25182319_6Ybe.jpg)
6、冲突解决
若出现冲突,Files窗口中会出现冲突的文件(State状态有提示),双击出现冲突的文件可以软件中解决冲突也可以忽略掉在Eclipse中解决后再重新Stage、Commit、Pull、Push提交代码
![](http://static.oschina.net/uploads/img/201601/25182319_ANVU.jpg)
7、Eclipse导入克隆仓库中的项目(注意不要选择copy到工作空间的选项):这样SmartGit就会及时检测到Eclipse中代码的改变
8、 SmartGit右上角的设置(避免无用文件出现):
![](http://static.oschina.net/uploads/img/201601/25182320_36uX.jpg)
总结:提交代码记住四步顺序不能错:Stage、Commit、Pull、Push