~Git笔记_3/4

==== 多分支 ====

 

  • 新建分支
[jesse@localhost test02]$ git branch testing       // 创建testing

[jesse@localhost test02]$ git checkout testing     // HEAD由指向master到指向testing

 Switched to branch 'testing'

或者 创建后直接切换到新的分支:

[jesse@localhost test02]$ git checkout -b "hotfix"
 Msrc/main.c
 Switched to a new branch 'hotfix'

 

  • 删除分支:
[jesse@localhost test02]$ git branch -d hotfix
 Deleted branch hotfix (was d7802fa).

 

  • 分支的合并

切换到master分支,合并testing分支: 

[jesse@localhost test02]$ git checkout master
 Switched to branch 'master'

[jesse@localhost test02]$ git merge testing
 Auto-merging src/main.c
 Merge made by recursive.
 src/main.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

  

  利用工具解决冲突部分:

  [jesse@localhost test02]$ git mergetool


 

 

==== 配置工具 ====

修改~/.gitconfig配置文件:

diff工具配置
$ git config --global merge.tool vimdiff
Git可以理解 kdiff3,tkdiff,meld,xxdiff,emerge,vimdiff,gvimdiff,ecmerge,和 opendiff 等合并工具的输出信息。
例如:
[diff] 
    external = extDiff 
[gui] 
    spellingdictionary = none 
[mergetool] 
    trustExitCode = false 
[merge] 
    tool = p4merge 
[mergetool "p4merge"] 
    cmd = p4merge /"$BASE/" /"$LOCAL/" /"$REMOTE/" /"$MERGED/"

    

  安装git完毕,再安装gitg,一个git图形化工具。

  最好再安装个比较工具p4merge。

    http://www.perforce.com/product/components/perforce_visual_merge_and_diff_tools

 

~Git笔记_3/4_第1张图片

 

 

 

==== 开源之门 ====

 

下载linus的仓库:

[jesse@localhost demo]$ git clone https://github.com/mirrors/linux-2.6.git

Initialized empty Git repository in /home/jesse/workMe/git/workspace/demo/linux-2.6/.git/
remote: Counting objects: 2280391, done.
remote: Compressing objects: 100% (428543/428543), done.
remote: Total 2280391 (delta 1904916), reused 2188547 (delta 1829939)
Receiving objects: 100% (2280391/2280391), 538.73 MiB | 144 KiB/s, done.
Resolving deltas: 100% (1904916/1904916), done.

 

查看内核分支——图形化界面:

~Git笔记_3/4_第2张图片

 

至少有这么几个好处:

1.需要哪个版本的内核不再是反复从官网下载五六十兆的源码,可谓一次下载,尽握所有版本。

2.直观的版本控制,观摩世界级大牛如何提交patch,又是如何管理如此巨大的工程。

 

坏处:

需要一台性能好点的机器,否则会卡,gitg也很可能崩溃。

 

Qgit下载:

http://sourceforge.net/projects/qgit/files/qgit4/

 

 

http://hi.baidu.com/kebey2004/item/030ad717e750df9e99ce33d8

http://hi.baidu.com/kebey2004/item/593c6c912400b8bb83d295dc

你可能感兴趣的:(git)