Git Pro 笔记--Git基础
2015-12-24 15:01
357 查看
git 基础
配置信息
git config --list查询配置文件的内容
git config --global user.name "lango"设置用户名
git config --global user.email yaowenlang1989@163.com设置用户邮箱
git config user.name查询现在用的用户名
git config user.email查询现在用的邮箱地址
.gitigore忽略文件配置
git help 三种方法
git help <verb>
git <verb> --help
man git-<verb>
创建Git Repository
git init在现有的工程目录创建用来管理当前项目
git clone [url] [project name]克隆现有的仓库
五个区域
“Stash” “WorkSpace” “Stage(Index)” “Repository” “Origin”文件状态
tracked"unmodified" "modified" "stage"
untracked
Git 存储方式
保存的是一系列不同时刻到快照基本命令
git status [-s]查看文件状态
git diff查看WorkSpace对比Index更新内容
git diff --staged查看Index对比Repository更新内容
git log [-v][--pretty=oneline]查看提交历史
git add [file]暂存file文件
git commit [-m 'msg']提交到Repository
git commit -a把所有tracked文件和Stage区文件一并提交
git rm <file>把文件从WorkSpace和Index删除
git rm --cached <file>只删除Index的文件
git mv A B把文件名称A该名成B名称
git checkout <file>文件从Index取到WorkSpace进行覆盖
git checkout HEAD <file>文件从Repository取到Index和WorkSpace进行覆盖
git resetRepository最新版本重置到Index
远程仓库
git clone [url]克隆一个仓库
git remote [-v]查看已经配置的远程仓库服务器
git remote show [remote-name]查看更多信息
git remote add <shortname> <url>链接的引用简写
git fetch [remote-name]从远程仓库获得数据,不会合并分支
git push [remote-name][branch-name]推送到远程仓库
git pull自动抓取然后合并远程分支到当前分支
git remote rename引用重命名
git remote rm [shortname]删除远程仓库
标签
git tag [-l 'version']列出已有到标签
git tag v1.4 -m 'my version 1.4'创建一个附注标签
git show v1.4显示附注标签v1.4信息
git tag v1.4-lw创建一个轻量标签
git show v1.4-lw显示轻量标签v1.4信息
git tag -a v1.2 [SHA-1]给历史版本打标签
git push origin v1.5标签共享到服务器
git push origin --tags一次推送多个标签
Git 别名
$ git config --glovall alias.com checkout把命令checkout改成co
相关文章推荐
- RPC failed; result=22, HTTP code = 411
- git更新已經刪除的文件
- 提取Git每次提交后Commit的文件
- GIT迁移服务器
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- git终极指南:在实际开发中的应用
- Git远程操作详解
- 25个 Git 进阶技巧(翻译)
- 详解版本控制利器Git,SVN的异同以及适用范围
- Ruby实现的删除已经合并的git分支脚本分享
- 在 Shell 提示符中显示 Git 分支名称的方法
- Git使用基础篇(一些常用命令和原理)
- git fork同步是什么意思?
- Git使用小坑 Out of memory错误的解决方法
- Python的高级Git库 Gittle
- 使用GIT进行源码管理――GUI客户端小结
- 使用git代替FTP部署代码到服务器的例子
- linux系统安装git及git常用命令
- 分享下自己总结的Git常用命令
- Git 常用命令速查表(图文+表格)