linux/cmd命令行语法规则、语法格式
语法解释:
<>: 必选参数
{ }: 必选参数,内部使用
[ ]: 可选参数
( ): 指明参数的默认值,只用于{ }中
|: 用于分割
… : 任意多个参数
&&:连接多个命令
--: 后跟参数名
. :当前
以git作为示例:以下是git命令所产生的提示信息
C:\Users\Administrator>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=]
[]
These are common Git commands used in various situations:
↑↑↑:
1.[ ]大括号代表可选参数[--version] [--help],也就是说可以直接输入git,
美联储决议http://www.gendan5.com/decision/usd.html 也可以输入git + [ ]内的内容,如:git --version
2. | 代表“或者”,意为选择一个参数[-p | --paginate | -P | --no-pager],如: git -p,git -P,git --paginate
3.<>代表必选参数[-C ],如:git -C './a.txt',path为必须输入的内容
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 clone ”http://......“;把远程仓库copy到本地工作副本
git clone ”http://......“;初始化一个本地git仓库
带用户名密码的clone方式:
git clone http://uname:pwd@remoteAddress
git clone http://uname:pwd@git@213245453.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
rm Remove files from the working tree and from the index
↑↑↑:本地仓库文件版本操作
1.git add . git add ./ git add :添加文件(夹)到版本库
2.git mv :移动或重命名
3.git reset HEAD :工作副本版本回退
4.git rm :移除文件树的版本控制状态等
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
↑↑↑:git操作输出信息
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
↑↑↑:本地工作副本控制
1.git commit -am "commit msg" :提交当前目录所有变更
2.git checkout branchname【branchname-分支名称】切换分支
3.git diff :查看当前目录的变更
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 ' or 'git help '
to read about a specific subcommand or concept.
↑↑↑:本地仓库与远程仓库交互
1.git fetch :拉取更新不合并
2.git pull :拉取当前目录下所有更新并合并本地副本
3.git push :推送当前目录下所有更新
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。