git help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>][--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare][--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
可以将git 作用的空间抽象为3个:工作目录(Working area),暂存区(Starging area),仓库(repository)。
工作目录就是你当前目录下的文件。
暂存区是用来暂存更改的文件的,放在工作目录和仓库中间,用来过度的。只能提交暂存区的文件,不能直接提交工作目录。
仓库保存了之前提交的所有记录,可以使用git log命令查看所有提交,而且可以回退到任意提交记录。
因为不能直接提交工作目录中更改的文件,所以必须使用git add [文件名]加入到暂存区,然后git commit提交。如果你不知道哪些文件更改了使用git status查看目前所有的更改。
目录
start a working area (see also: git help tutorial)
work on the current change (see also: git help everyday)
examine the history and state (see also: git help revisions)
grow, mark and tweak your common history
collaborate (see also: git help workflows)
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
启动工作区
clone
Clone a repository into a new directory
将存储库克隆到新目录
init
Create an empty Git repository or reinitialize an existing one
创建一个空的Git存储库或重新初始化一个现有的存储库
work on the current change (see also: git help everyday)
处理当前更改
add
Add file contents to the index
将文件内容添加到索引
mv
Move or rename a file, a directory, or a symlink
移动或重命名文件,目录或符号链接
reset
Reset current HEAD to the specified state
将当前HEAD重置为指定状态
rm
Remove files from the working tree and from the index
从工作树和索引中删除文件
examine the history and state (see also: git help revisions)
检查历史记录和状态
bisect
Use binary search to find the commit that introduced a bug
使用二进制搜索找到引入错误的提交,用来查找哪一次代码提交引入了错误
grep
Print lines matching a pattern
搜索文本文件中与指定正则表达式匹配的行
log
Show commit logs
显示提交日志
show
Show various types of objects
显示各种类型的对象
status
Show the working tree status
显示工作树状态
grow, mark and tweak your common history
成长,标记和调整您的共同历史
branch
List, create, or delete branches
分支列出,创建或删除分支
checkout
Switch branches or restore working tree files
检出切换分支或还原工作树文件
commit
Record changes to the repository
记录对存储库的更改
diff
Show changes between commits, commit and working tree, etc
显示提交,提交和工作树等之间的更改
merge
Join two or more development histories together
将两个或多个开发历史联系在一起
rebase
Reapply commits on top of another base tip
重新提交在另一个基本提示之上的提交
tag
Create, list, delete or verify a tag object signed with GPG
创建,列出,删除或验证使用GPG签名的标签对象
collaborate (see also: git help workflows)
协作
fetch
Download objects and refs from another repository
从另一个存储库获取下载对象和参考
pull
Fetch from and integrate with another repository or a local branch
从另一个存储库或本地分支中提取并与之集成
push
Update remote refs along with associated objects
推送更新远程引用以及相关对象
'git help -a' and 'git help -g' list available subcommands and some concept guides. See 'git help <command>' or 'git help <concept>' to read about a specific subcommand or concept.