赞
踩
Git是一种目前使用最广泛且功能最强大的版本控制系统,它用于跟踪计算机文件的更改并协调多人之间的文件工作。
它的主要领域用于软件开发中的源代码管理,其实它可用于跟踪任何文件集中的更改。
Git由Linus Torvalds于2005年开发,作为分布式开源软件版本控制软件,当然可以免费使用。它旨在提高速度,数据完整性以及对分布式非线性工作流程的支持。
其他版本控制系统(例如CVS,SVN)将大部分数据(如提交日志)保存在中央服务器上,在Git中,每台计算机上的每个Git存储库都是一个完整的库,具有完整的历史记录和完整的版本跟踪功能,独立于网络访问或中央服务器。
目前几乎所有的IDE都支持Git开箱即用,并不需要我们手动提交Git命令,但了解这些命令总是好的。
下面为各位总结一些使用Git高效工作的指令列表。
Git中最有用的命令是git help,它为我们提供所需的全部帮助。我们在终端输入git help终,将获得如下信息:
usage: git [--version] [--help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] []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 onework 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 rm Remove files from the working tree and from the indexexamine 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 statusgrow, 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 GPGcollaborate (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 someconcept guides. See 'git help ' or 'git help 'to read about a specific subcommand or concept.
命令git help -a将为我们提供完整的Git命令列表:
usage: git [--version] [--help] [-C ] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] []available git commands in '/usr/local/git/libexec/git-core' add merge-octopus add--interactive merge-one-file am merge-ours annotate merge-recursive apply merge-resolve archimport merge-subtree archive merge-tree bisect mergetool bisect--helper mktag blame mktree branch mv bundle name-rev cat-file notes check-attr p4 check-ignore pack-objects check-mailmap pack-redundant check-ref-format pack-refs checkout patch-id checkout-index prune cherry prune-packed cherry-pick pull citool push clean quiltimport clone read-tree column rebase commit rebase--helper commit-graph receive-pack commit-tree reflog config remote count-objects remote-ext credential remote-fd credential-cache remote-ftp credential-cache--daemon remote-ftps credential-store remote-http cvsexportcommit remote-https cvsimport remote-testsvn cvsserver repack daemon replace describe request-pull diff rerere diff-files reset diff-index rev-list diff-tree rev-parse difftool revert difftool--helper rm fast-export send-email fast-import send-pack fetch serve fetch-pack sh-i18n--envsubst filter-branch shell fmt-merge-msg shortlog for-each-ref show format-patch show-branch fsck show-index fsck-objects show-ref gc stage get-tar-commit-id stash grep status gui stripspace gui--askpass submodule hash-object submodule--helper help subtree http-backend svn http-fetch symbolic-ref http-push tag imap-send unpack-file index-pack unpack-objects init update-index init-db update-ref instaweb update-server-info interpret-trailers upload-archive log upload-pack ls-files var ls-remote verify-commit ls-tree verify-pack mailinfo verify-tag mailsplit web--browse merge whatchanged merge-base worktree merge-file write-tree merge-indexgit commands available from elsewhere on your $PATH credential-osxkeychain'git help -a' and 'git help -g' list available subcommands and someconcept guides. See 'git help ' or 'git help 'to read about a specific subcommand or concept.
命令git help -g将给我们一个git概念,Git会给我们一个有价值的列表:
The common Git guides are: attributes Defining attributes per path cli Git command-line interface and conventions core-tutorial A Git core tutorial for developers cvs-migration Git for CVS users diffcore Tweaking diff output everyday A useful minimum set of commands for Everyday Git glossary A Git Glossary hooks Hooks used by Git ignore Specifies intentionally untracked files to ignore modules Defining submodule properties namespaces Git namespaces repository-layout Git Repository Layout revisions Specifying revisions and ranges for Git tutorial A tutorial introduction to Git tutorial-2 A tutorial introduction to Git: part two workflows An overview of recommended workflows with Git'git help -a' and 'git help -g' list available subcommands and someconcept guides. See 'git help ' or 'git help 'to read about a specific subcommand or concept.
我们可以使用git help 或git help 命令更多地了解特定命令或概念。
我将这些命令作为备注供自己将来参考,您可以在此Github存储库中找到更多信息,欢迎在文底提供宝贵的反馈!
作者:洛逸
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。