git 命令
来源:互联网 发布:mysql数据库结构设计 编辑:程序博客网 时间:2024/05/16 08:06
以下命令都以内核中的Makefile文件为例,即common/Makefile这个文件。
git configEdit section
查看配置
git config –list
配置用户名和邮箱
git config –global user.name “Sunny Luo”
git config –global user.email sunny.luo@amlogic.com
配置亮色显示
git config –global color.ui true
git log
查看提交的修改
git log -p
查看每个提交修改的文件
git log –name-status
根据作者查找提交
git log –author=”sunny.luo”
根据关键字查找提交
git log –grep=”PD#123456”
跟踪文件或文件夹的修改
git log –follow Makefile
git blame
查看代码行的修改
git blame -L 10,20 Makefile
git
常用命令
• git config
• git log / git status / git blame
• git format-patch / git am/ git apply / git diff
• git add /git commit / git push
• git reset / git revert
• git branch / git remote
• git checkout
• git clone / git pull
git config
git config –global user.name “First Last”
git config –global user.email “first.last@amlogic.com”
git config –global color.ui true
git config –gloabl core.editor vim
show config
git config –list
git log
show all changed files
git log –name-status
show log commited by author
git log –author=
show log for only one file
git log –follow
git log -p
git blame
show log from line n to m
git blame -L
single patch
git format-patch -1
multiple patches
git format-patch -3
git format-patch
other options
-o, –output-directory
git am
for patch created by format-patch
git am
resolve conflict
git apply –reject
edit and git add…, git commit…
git am –resolved
git apply
for patch created by diff
git apply -p1
git diff
ignore space
git diff –ignore-space-change
git diff –ignore-all-space
for commited files. not for untracked files.
git diff –cached
create diff format patch
git diff > output.patch
git add
git add
git add -A
git add .
git commit
git commit
git commit -m
git commit -a
git push
for tracked branch
git push origin amlogic-3.10-bringup
for untracked branch
git push review HEAD:refs/for/amlogic-3.10-dev
git reset
for un-committed files
git reset –soft HEAD
git reset –hard HEAD
for commited files
git reset HEAD
see the help message of git status command.
git revert
for pushed commit
git revert
git branch
show local branches
git branch
show remote branch
git branch -r
create local branch
git branch
delete local branch
gti branch -d
gti branch -D
git remote
show local remote
git remote
add remote
git remote add
example:
git remote add review ssh://scgit.amlogic.com:29418/kernel/common.git
git remote set-url
git remote rm
git checkout
git checkout
git checkout -t -b
git clone
git clone
example:
git clone git://scgit.amlogic.com/kernel/common.git
git pull
update code, just fetch and then merge
git pull
git help
show most commonly used git commands
git help
show short help
git -h
show more help
git –help
resources
Pro Git (zh)
http://git-scm.com/book/zh/v1/
Pro Git (en)
https://progit.org/
- Git 命令
- git命令
- git 命令
- git命令
- Git命令
- git 命令
- git 命令
- Git命令
- git命令
- Git命令
- git命令
- git 命令
- git命令
- git命令
- git命令
- git命令
- git命令
- git 命令
- 辛星整理python语言的两个独特之处
- 提高 HTML5 画布性能
- php-win.exe无法定位程序输入点output_globals_id于动态链接库
- plsql代码加密命令wrap
- sparkHA配置报错
- git 命令
- Python类属性和实例属性
- Ext Js 4.x 解析Json
- 解析包失败
- [BZOJ1227][SDOI2009]虔诚的墓主人
- 交换算法swap
- SIMD指令初学
- java基础Haep(堆)和Stack(栈)区别
- Netty 服务器客户端,发送自定义消息