首页 > 代码库 > git使用

git使用

git --help

用法: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 命令:

开始一个工作区(参见:git help tutorial)
  clone      克隆一个仓库到一个新目录
  init       创建一个空的 Git 仓库或重新初始化一个已存在的仓库

在当前变更上工作(参见:git help everyday)
  add        添加文件内容至索引
  mv         移动或重命名一个文件、目录或符号链接
  reset      重置当前 HEAD 到指定状态
  rm         从工作区和索引中删除文件

检查历史和状态(参见:git help revisions)
  bisect     通过二分查找定位引入 bug 的提交
  grep       输出和模式匹配的行
  log        显示提交日志
  show       显示各种类型的对象
  status     显示工作区状态

扩展、标记和调校您的历史记录
  branch     列出、创建或删除分支
  checkout   切换分支或恢复工作区文件
  commit     记录变更到仓库
  diff       显示提交之间、提交和工作区之间等的差异
  merge      合并两个或更多开发历史
  rebase     本地提交转移至更新后的上游分支中
  tag        创建、列出、删除或校验一个 GPG 签名的标签对象

协同(参见:git help workflows)
  fetch      从另外一个仓库下载对象和引用
  pull       获取并整合另外的仓库或一个本地分支
  push       更新远程引用和相关的对象

git help -g

最常用的 Git 向导有:
  attributes   定义路径的属性
  everyday     每一天 Git 常用的约 20 条命令
  glossary     Git 词汇表
  ignore       忽略指定的未跟踪文件
  modules      定义子模组属性
  revisions    指定 Git 的版本和版本范围
  tutorial     一个 Git 教程(针对 1.5.1 或更新版本)
  workflows    Git 推荐的工作流概览

git help -a

在 ‘/usr/lib/git‘ 下可用的 git 命令

 add                       gc                        reflog
 add--interactive          get-tar-commit-id         relink
 am                        grep                      remote
 annotate                  gui                       remote-ext
 apply                     gui--askpass              remote-fd
 archive                   hash-object               remote-ftp
 bisect                    help                      remote-ftps
 bisect--helper            http-backend              remote-http
 blame                     http-fetch                remote-https
 branch                    http-push                 remote-testsvn
 bundle                    imap-send                 repack
 cat-file                  index-pack                replace
 check-attr                init                      request-pull
 check-ignore              init-db                   rerere
 check-mailmap             instaweb                  reset
 check-ref-format          interpret-trailers        rev-list
 checkout                  log                       rev-parse
 checkout-index            ls-files                  revert
 cherry                    ls-remote                 rm
 cherry-pick               ls-tree                   send-email
 citool                    mailinfo                  send-pack
 clean                     mailsplit                 sh-i18n--envsubst
 clone                     merge                     shell
 column                    merge-base                shortlog
 commit                    merge-file                show
 commit-tree               merge-index               show-branch
 config                    merge-octopus             show-index
 count-objects             merge-one-file            show-ref
 credential                merge-ours                stage
 credential-cache          merge-recursive           stash
 credential-cache--daemon  merge-resolve             status
 credential-store          merge-subtree             stripspace
 cvsexportcommit           merge-tree                submodule
 cvsimport                 mergetool                 subtree
 cvsserver                 mktag                     svn
 describe                  mktree                    symbolic-ref
 diff                      mv                        tag
 diff-files                name-rev                  unpack-file
 diff-index                notes                     unpack-objects
 diff-tree                 p4                        update-index
 difftool                  pack-objects              update-ref
 difftool--helper          pack-redundant            update-server-info
 fast-export               pack-refs                 upload-archive
 fast-import               patch-id                  upload-pack
 fetch                     prune                     var
 fetch-pack                prune-packed              verify-commit
 filter-branch             pull                      verify-pack
 fmt-merge-msg             push                      verify-tag
 for-each-ref              quiltimport               web--browse
 format-patch              read-tree                 whatchanged
 fsck                      rebase                    worktree
 fsck-objects              receive-pack              write-tree

git使用