用linux/cmd該怎麼操作

專注的阿熊發表於2020-01-07

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,

美聯儲決議 也可以輸入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 ”“;把遠端倉庫copy到本地工作副本
git clone ”“;初始化一個本地git倉庫


帶使用者名稱密碼的clone方式:
git clone
git clone
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 :推送當前目錄下所有更新

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69946337/viewspace-2672315/,如需轉載,請註明出處,否則將追究法律責任。

相關文章