[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配置文件:

$ 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/
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律