git操作手册
来源:互联网 发布:淘宝哪家大闸蟹好 编辑:程序博客网 时间:2024/05/02 14:15
先推荐两本书《pro_git_中文版本》、《git权威指南》
pro_git可以从git的官网下载:http://www.git-scm.com/book/zh/v2
gerrit:http://code.google.com/p/gerrit/
1、下载代码
- repo init -u [url] -m [manifest.xml] -b [branch]
- repo sync
2、修改代码
- repo start [branch] --all
- vi [file]
3、上传代码
- git rm [file]
- git mv [file] [file']
- git add [files]
- git commit
- repo sync
- repo upload
4、只同步某个git库
- repo status
- repo sync <project>
5、最后一次提交,发现代码(或者提交log)有错误,或是提交被打回,怎么办
- vi [file]
- git add .
- git commit --amend
- repo upload
6、提交回退
- 要回退某个commit,可以使用gerrit上的“revertchange”操作。需要注意的是该操作只会为你在gerrit上自动生成一个回退提交[commit']。该回退提交[commit']还需要进行merge操作才能真正提交到远程库。
7、检出当前git库的某个历史版本
- git checkout -b [branch] [commit]
8、查看tag
- git tag
- git show [tag]
9、已经修改了代码才想起来自己没有建分支
- git branch [branch]
- repo start [branch'] --all
10、A同学和B同学都修改了C文件并同时上传了gerrit,A同学的提交被merge到了远程库,B同学的提交由于冲突无法merge,B同学应该怎么办。
- repo sync
- git rebase [remote branch]
- repo upload
11、获取帮助
- repo help [command]
- git help [command]
- repo help
- git help
12、查看日志
- git log
- git log [file]
13、查看git配置信息
- git config --list
14、把另一个本地分支的commit应用到当前分支
- git cherry-pick [commit_id]
15、补丁的使用
- git format-patch [commit_1]..[commit_2]
- git format-patch [commit]
- git am [patch]
16、查看所有分支和最后一次提交
- git branch -a -v
17、生成repo仓快照
repo manifest -r -o snapshot.xml- Git操作手册
- git操作手册
- Git操作手册
- git 操作手册
- git操作手册
- git操作手册
- git 操作手册
- git操作手册
- GIT 快速操作手册
- Git操作手册(上)
- git最全操作手册
- Git操作手册|命令速查表
- [git] 操作手册 --不定期更新
- Git操作手册|命令速查表
- linux --git 操作手册
- Git- gerrit操作手册 for 开发人员
- 操作手册
- 操作手册
- 宏
- Android sqlite 三表查询
- VM上的LINUX虚拟机共享Windows文件夹
- 深入浅出进程与线程的基本概念
- 第一个Java程序
- git操作手册
- 加拿大工业部部长:对黑莓失业员工表示同情
- 详解大端模式和小端模式
- HDU 4751 交叉染色判断二分图
- 关于快排 与 中位数
- Spring 使用log4j
- 面向报文(UDP)和面向字节流(TCP)的区别
- Python小贴士之赋值语句、分支语句和循环语句
- Linux中SPI子系统图解和mini2440下的SPI驱动移植