git使用命令整理
来源:互联网 发布:php文件上传 编辑:程序博客网 时间:2024/05/22 06:46
Git 是当前最流行的版本控制程序之一,文本包含了 Git 的一些基本用法 创建 git 仓库 初始化 git 仓库
Git 命令示例:
mkdir project # 创建项目目录
cd project # 进入到项目目录
git init # 初始化 git 仓库。此命令会在当前目录新建一个 .git 目录,用于存储 git 仓库的相关信息
初始化提交
touch README
git add . # 将当前目录添加到 git 仓库中, 使用 git add -A 则是添加所有改动的文档
git commit -m "Initial commit"
git remote add origin git @github.com:lugir /repo.git # 设置仓库
修补提交(修补最近一次的提交而不创建新的提交)
git commit --amend -m "commit message."
提交冲突时可以合并后再推送
git pull # 获取远程版本库提交与本地提交进行合并
git push # 提交
使用别人的仓库
git clone http: //path /to /git.git # clone 的内容会放在当前目录下的新目录
将代码从本地回传到仓库
git push -u origin master
使用 git status 查看文件状态
git status
查看提交日志
git log # 查看提交信息
git log --pretty=oneline # 以整洁的单行形式显示提交信息
Git 分支
git branch # 查看分支
git branch 6.x- 1.x # 添加分支 6.x-1.x
git branch checkout master # 切换到主分支
git branch -d 6.x- 1.x # 删除分支 6.x-1.x
git push origin :branchname # 删除远端分支
Git 标签
git tag # 查看分支
git tag 6.x- 1.0 # 添加标签 6.x-1.0
git show 6.x- 1.0 # 查看标签 6.x-1.0 的信息
git tag -a 6.x- 1.0 965e066 # 为之前提交的信息记录 965e066 加上标签
git push --tags # 提交时带上标签信息
git push origin : /refs /tags /tagname # 删除远端标签
从 git 仓库中导出项目
git archive --format tar --output /path /to /file.tar master # 将 master 以 tar 格式打包到指定文件
使用 Git 的一些基本守则: 当要commit/提交patch时:
·使用 git diff --check 检查行尾有没有多余的空白
·每个 commit 只改一件事情。如果一个文档有多个变更,使用 git add --patch 只选择文档中的部分变更进入 stage
·写清楚 commit message
The most commonly used git commands are:
所有最常用的git命令说明:
add Add file contents to the index
添加文件的内容添加到索引
bisect Find by binary search the change that introduced a bug
平分找到通过二进制搜索的变化引入了一个错误
branch List, create, or delete branches
分支列表、创建或删除分支
checkout Checkout a branch or paths to the working tree
检出 检出一个分支或路径树
clone Clone a repository into a new directory
克隆克隆存储库到一个新的目录
commit Record changes to the repository
提交 记录更改存储库
diff Show changes between commits, commit and working tree, etc
比较文件的差异显示之间的更改提交,提交和工作树,等等
fetch Download objects and refs from another repository
取出 从另一个存储库下载对象和参考文献
grep Print lines matching a pattern
在文件内容中查找 打印模式匹配的行
init Create an empty Git repository or reinitialize an existing one
初始化 创建一个空的Git存储库或重新启动一个现有的一个
log Show commit logs
日志 显示提交日志
merge Join two or more development histories together
合并 一起加入两个或两个以上的发展历史
mv Move or rename a file, a directory, or a symlink
移动文件 移动或重命名一个文件、目录或符号链接
pull Fetch from and integrate with another repository or a local branch
拉 获取和整合与另一个存储库或当地的分支机构
push Update remote refs along with associated objects
提交 更新远程参考文献以及相关的对象
rebase Forward-port local commits to the updated upstream head
垫底 向本地提交更新的上行的头
reset Reset current HEAD to the specified state
重置重置当前前往指定的状态
rm Remove files from the working tree and from the index
删除 从工作树,从索引中删除文件
show Show various types of objects
显示 显示各种类型的对象
status Show the working tree status
状态 树显示工作状态
tag Create, list, delete or verify a tag object signed with GPG
标签 创建列表,删除或验证一个标签对象签订GPG
Git help -g
The common Git guides are:
常用的Git指南:
attributes: Defining attributes per path
属性:每个路径定义属性
glossary: A Git glossary
词汇:一个Git术语
ignore: Specifies intentionally untracked files to ignore
忽略:忽略故意未指定文件
modules: Defining submodule properties
模块:定义模块性能
revisions: Specifying revisions and ranges for Git
修改:修改范围指定地点
tutorial: A tutorial introduction to Git (for version 1.5.1 or newer)
教程:教程介绍Git(版本1.5.1或更新版本)
workflows: An overview of recommended workflows with Git
工作流程:用git推荐流程概述
- Git使用命令整理
- git使用命令整理
- git 日常使用命令整理
- 整理Git的命令使用
- GIT基本使用命令整理
- GIT命令整理
- 常用git命令整理
- Git基本命令整理
- 常用git命令整理
- Git命令整理
- Git基本命令整理
- git命令整理
- Git命令整理
- git 基本命令整理
- git命令整理
- git命令整理
- git基础命令整理
- GIT命令整理
- Android应用性能剖析全攻略
- Java回调机制解析
- 小有收获的一天。
- 第14周项目3是否为二叉排序树
- 第十六周上机实践项目1 - 验证算法(堆排序)
- git使用命令整理
- Day1之ForDemo
- 第十六周--项目2算法验证快速排序
- 第十五周 项目1 排序(基数排序)
- 第6周项目2建立链栈算法库
- 第十六周项目二~~大数据集上排序算法性能的体验
- js script放在head跟body里面的区别
- Unknown provider CookieStore
- Xcode插件失效