[Git] ~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

 

 

 

 

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

 

下载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.

 

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

 

至少有这么几个好处:

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

posted @   郝壹贰叁  阅读(530)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示