编辑推荐: |
本文来自csdn,文章主要介绍了在ubuntu14.04环境下git的基本使用方法,一个分支模型中,各个操作的流程和其对于开发过程的意义等。 |
|
1、实际使用的是svn与git结合,没有单纯的使用svn或git,当然svn和git都是一套完整的VCS(version control system)。
2、为什么要结合使用git?
之前使用的是svn,因为开发与测试工作并行,需要打很多分支,svn在分支合并上,处理不太好(合并可能会产生很多冲突,冲突处理时间较长,慢慢就弃用了svn的分支处理功能),所以采用了git。
3、对一个文件SmsTemplateBuilder.java进行修改(使用git的命令行操作,没有使用界面管理工具,当然界面管理工具也是可行的)
4、git初始化界面

5、使用git查看文件状态
命令:git status

6、跟踪文件
命令: git add

7、在分支上提交
git commit –m “message”

8、切换分支(master是一个特殊的分支,所用的分支要向它合并)
git checkout branch_name

9、合并分支
git merge branch_name

10、更新master
git svn rebase (这个命令式针对于git与svn结合的情况使用的,之前的命令,如:git add,git commit可以适用于单独git的环境)

11、将代码提交到svn上
git svn dcommit

12、为什么使用svn与git结合?不知是用git?
项目原来是由svn管理,不想把项目的版本控制信息(具体就是各个文件的修改记录)抛弃,所以还使用svn管理项目;
而采用git进行本地开发,随意创建分支,切换分支,合并分支。
13、查看有哪些分支
git branch

14、切换到其他分支

15、提交代码时(git svn rebase之后),可能产生冲突,具体的操作省略
git svn rebase 冲突:
git add .
然后,再执行:
git rebase --continue
如果报告说没有修改内容,则换成执行:
git rebase --skip
16、配合
Eclipse中对git的支持(git插件)

|