git help 查看全部命令
$ git help usage: git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>] <command> [<args>] 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 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 restore Restore working tree files rm Remove files from the working tree and from the index sparse-checkout Initialize and modify the sparse-checkout examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug diff Show changes between commits, commit and working tree, etc 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 commit Record changes to the repository merge Join two or more development histories together rebase Reapply commits on top of another base tip reset Reset current HEAD to the specified state switch Switch branches tag Create, list, delete or verify a tag object signed with 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. See 'git help git' for an overview of the system.
git help xxx
例如:git help log 会在默认浏览器中打开一个页面,显示命令详情html
git log
git log --oneline // 日志显示的格式 one line git log -n number // 显示指定 number 数量的日志 git log --graph --oneline // 能够查询 提交记录的图
git status
提交的产生一般被分为两个步骤。首先咱们用add命令将全部相关的修改归入到暂存区(staging area),接着才能用commit命令将暂存区中的修改传送到版本库中。 经过status命令,能够查看当前工做区中所发生的修改,以及其中的哪些修改已经被注册到了暂存区中。git
上图可按照如下几个小标题浏览器
- Changes to be committed:这部分修改已经在暂存区中,将在下次commit中被归入版本库中
- Changes not staged for commit:这部分修改尚未添加到暂存区,下次commit时不会被提交到版本库中
- Untracked files:伟被追踪的文件
在每一个标题下面,git都有相关的帮助提高,告诉咱们应该用什么命令来从新改变这些状态。app
例如:咱们能够用如下命令将 foot.txt移出暂存区。ide
git restore --staged foo.txt