git操作Linux kernel
来源:互联网 发布:js修改css样式 编辑:程序博客网 时间:2024/05/18 02:24
Linux kernel 的官方 GIT地址是:
http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git
可以从这个地址拿到 kernel 的 代码仓库。
1. 拿代码仓库
- git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
2. 查看状态:
- $ git status
- # On branch master
- nothing to commit (working directory clean)
3. 更新本地的代码:
- $ git pull
- Already up-to-date.
4. 切换到分支:
- $ git checkout linux-3.10.y
- Checking out files: 100% (25952/25952), done.
- Switched to branch 'linux-3.10.y'
- $ git branch
- * linux-3.10.y
- master
- $ git branch -a
- * linux-3.10.y
- master
- remotes/origin/HEAD -> origin/master
- remotes/origin/linux-2.6.11.y
- remotes/origin/linux-2.6.12.y
- remotes/origin/linux-2.6.13.y
- remotes/origin/linux-2.6.14.y
- remotes/origin/linux-2.6.15.y
- remotes/origin/linux-2.6.16.y
- remotes/origin/linux-2.6.17.y
- remotes/origin/linux-2.6.18.y
- remotes/origin/linux-2.6.19.y
- remotes/origin/linux-2.6.20.y
- remotes/origin/linux-2.6.21.y
- remotes/origin/linux-2.6.22.y
- remotes/origin/linux-2.6.23.y
- remotes/origin/linux-2.6.24.y
- remotes/origin/linux-2.6.25.y
- remotes/origin/linux-2.6.26.y
- remotes/origin/linux-2.6.27.y
- remotes/origin/linux-2.6.28.y
- remotes/origin/linux-2.6.29.y
- remotes/origin/linux-2.6.30.y
- remotes/origin/linux-2.6.31.y
- remotes/origin/linux-2.6.32.y
- remotes/origin/linux-2.6.33.y
- remotes/origin/linux-2.6.34.y
- remotes/origin/linux-2.6.35.y
- remotes/origin/linux-2.6.36.y
- remotes/origin/linux-2.6.37.y
- remotes/origin/linux-2.6.38.y
- remotes/origin/linux-2.6.39.y
- remotes/origin/linux-3.0.y
- remotes/origin/linux-3.1.y
- remotes/origin/linux-3.10.y
- remotes/origin/linux-3.11.y
- remotes/origin/linux-3.12.y
- remotes/origin/linux-3.13.y
- remotes/origin/linux-3.14.y
- remotes/origin/linux-3.2.y
- remotes/origin/linux-3.3.y
- remotes/origin/linux-3.4.y
- remotes/origin/linux-3.5.y
- remotes/origin/linux-3.6.y
- remotes/origin/linux-3.7.y
- remotes/origin/linux-3.8.y
- remotes/origin/linux-3.9.y
- remotes/origin/master
6. 创建一个新分支:
- $ git checkout -b linux-3.10-charles
- Switched to a new branch 'linux-3.10-charles'
- $ git branch
- * linux-3.10-charles
- linux-3.10.y
- master
- git add .
- $ git status
- # On branch linux-3.10-charles
- # Changes to be committed:
- # (use "git reset HEAD <file>..." to unstage)
- #
- # modified: init/main.c
- #
- e$ git add -i
- staged unstaged path
- 1: +2/-0 nothing init/main.c
- *** Commands ***
- 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
- 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
- What now>
如果选择 revert 命令,相当于 undo "git add .":
- What now> r
- staged unstaged path
- 1: +2/-0 nothing [i]nit/main.c
- Revert>>
- reverted one path
- *** Commands ***
- 1: [s]tatus 2: [u]pdate 3: [r]evert 4: [a]dd untracked
- 5: [p]atch 6: [d]iff 7: [q]uit 8: [h]elp
- What now> q
- $ git status
- # On branch linux-3.10-charles
- # Changes not staged for commit:
- # (use "git add <file>..." to update what will be committed)
- # (use "git checkout -- <file>..." to discard changes in working directory)
- #
- # modified: init/main.c
- #
- no changes added to commit (use "git add" and/or "git commit -a")
8. 提交修改:
- $ git commit -a -m "This is just for testing git"
- [linux-3.10-charles 9eabb78] This is just for testing git
- 1 file changed, 1 insertion(+), 1 deletion(-)
- commit 9eabb788b5c33efed589b1263aedd69b97e592ac
- Author: Taotao Ding <htdkd@hotmail.com>
- Date: Wed May 7 03:36:55 2014 +0900
- This is just for testing git
- commit 5d897eedc505bb8af1f4865ae381eadbfd3bc8c1
- Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- Date: Tue May 6 07:56:24 2014 -0700
- Linux 3.10.39
- commit 6b32172a1d3cffa74067ced96612bd13658d4fcf
- Author: Felipe Balbi <balbi@ti.com>
- Date: Tue Feb 25 10:58:43 2014 -0600
- usb: musb: avoid NULL pointer dereference
- git log -p
- commit 9eabb788b5c33efed589b1263aedd69b97e592ac
- Author: Taotao Ding <htdkd@hotmail.com>
- Date: Wed May 7 03:36:55 2014 +0900
- This is just for testing git
- diff --git a/init/main.c b/init/main.c
- index e83ac04..febc1e9 100644
- --- a/init/main.c
- +++ b/init/main.c
- @@ -10,7 +10,7 @@
- */
- #define DEBUG /* Enable initcall_debug */
- -
- +/* This is a test line for git */
- #include <linux/types.h>
- #include <linux/module.h>
- #include <linux/proc_fs.h>
10: 查看一个文件最近的修改记录:
- $ git log master..HEAD init/main.c
- commit 9eabb788b5c33efed589b1263aedd69b97e592ac
- Author: Taotao Ding <htdkd@hotmail.com>
- Date: Wed May 7 03:36:55 2014 +0900
- This is just for testing git
- commit b7a52f5111bc53ffbfff96330621cbde80df6ba4
- Author: Theodore Ts'o <tytso@mit.edu>
- Date: Tue Sep 10 10:52:35 2013 -0400
- random: run random_int_secret_init() run after all late_initcalls
- commit 47d06e532e95b71c0db3839ebdef3fe8812fca2c upstream.
- The some platforms (e.g., ARM) initializes their clocks as
- late_initcalls for some unknown reason. So make sure
- random_int_secret_init() is run after all of the late_initcalls are
- run.
- Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
- Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
11: 比较两个分支的差异:
- $ git log linux-3.10.y..linux-3.10-charles
- commit 9eabb788b5c33efed589b1263aedd69b97e592ac
- Author: Taotao Ding <htdkd@hotmail.com>
- Date: Wed May 7 03:36:55 2014 +0900
- This is just for testing git
当前分支也可写成 HEAD,所以:
- $ git log linux-3.10.y..HEAD
- commit 9eabb788b5c33efed589b1263aedd69b97e592ac
- Author: Taotao Ding <htdkd@hotmail.com>
- Date: Wed May 7 03:36:55 2014 +0900
- This is just for testing git
reference:
http://www.opensourceforu.com/2011/05/linux-kernel-development-using-git/
P.S.
配置 username 和 user.email 的方法:
git config user.email "username"
git config user.email "email@server"
这两个命令改变 .git/config 配置文件 (local)
git config --global user.email "username"
git config --global user.email "email@server"
git config --global core.editor "vim"
则改变全局的 git 配置文件 (~/.gitconfig)
阅读全文
0 0
- git操作Linux kernel
- Git 克隆Linux kernel
- Linux kernel source git repositories
- Linux Kernel input ev操作
- https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
- 使用git下载linux的kernel源代码
- 使用git下载linux的kernel源代码
- Linux kernel 关机的底层操作
- 怎样用git获取指定的android linux kernel
- How to git clone linux kernel for developer(THE URL)
- linux git 常用操作集锦
- GIT LINUX下基本操作
- [系统操作][Linux]配置git
- linux操作 —— git
- git基础操作和linux基础操作
- Git Kernel Tag
- linux kernel
- Linux Kernel
- android 开发入门书籍推荐
- (十三)、Java复习笔记之反射
- 带模板的基于 Treap 的名次树
- python爬虫之豆瓣图片(二)
- Ros官网j基础教程总结
- git操作Linux kernel
- DNS服务及其管理
- PyTorch学习之路(level2)——自定义数据读取
- 第6次C练习
- C++中extern "C"的使用
- VMware无法连接 MKS:套接字连接尝试次数太多正在放弃
- Aspectj的使用demo
- execute immediate v_sql用法
- [LeetCode] 33. Search in Rotated Sorted Array