亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
characters

命名

gitcli  -  Git 命令行界面和約定

概要

gitcli

描述

本手冊(cè)介紹了在整個(gè) Git CLI 中使用的約定。

許多命令都采用修訂(通常是 “commits” ,但有時(shí)是 “ tree-ish ” ,取決于上下文和命令)和路徑作為它們的參數(shù)。這是規(guī)則:

  • 修訂首先是路徑。例如在git diff v1.0 v2.0 arch/x86 include/asm-x86,v1.0并且v2.0是修改,arch/x86并且include/asm-x86是路徑。

  • 當(dāng)一個(gè)論證可能會(huì)被誤解為一個(gè)修訂或一條路徑時(shí),他們可以通過放在--它們之間來消除歧義。例如git diff -- HEAD,“我的工作樹中有一個(gè)名為 HEAD 的文件,請(qǐng)?jiān)谒饕械陌姹綢和我在該文件的工作樹中顯示的內(nèi)容之間顯示更改”,而不是“顯示 HEAD 提交與工作之間的差異樹整體“。你可以說git diff HEAD --要問后者。

  • 在沒有歧義的情況下--,Git 會(huì)做出合理的猜測(cè),但會(huì)出錯(cuò)并要求您在模棱兩可時(shí)消除歧義。例如,如果你有一個(gè)在你的工作樹叫 HEAD 的文件,git diff HEAD是模糊的,而你不得不說要么git diff HEAD --git diff -- HEAD消除歧義。在編寫預(yù)期處理隨機(jī)用戶輸入的腳本時(shí),最好明確哪些參數(shù)是通過--在適當(dāng)?shù)奈恢眠M(jìn)行消除歧義來明確的。

  • 許多命令允許在路徑中使用通配符,但是您需要保護(hù)它們免受 shell 的影響。這兩個(gè)意思是不同的東西:

$ git checkout -- *.c $ git checkout -- \*.c

前者允許 shell 擴(kuò)展 fileglob ,并且要求工作樹中的 dot-C 文件被索引中的版本覆蓋。后者傳遞*.c給 Git,并且您要求索引中匹配模式的路徑被檢出到您的工作樹上。跑步后git add hello.c; rm hello.c,你會(huì)not看到hello.c你的工作樹與前者,但后者,你會(huì)。

  • 就像文件系統(tǒng).(句點(diǎn))引用當(dāng)前目錄一樣,在Git 中使用.作為存儲(chǔ)庫(kù)名稱(一個(gè)點(diǎn)存儲(chǔ)庫(kù))是一個(gè)相對(duì)路徑,并且表示您當(dāng)前的存儲(chǔ)庫(kù)。這里是關(guān)于您應(yīng)該遵循的“標(biāo)志”的規(guī)則當(dāng)你在編寫 Git 時(shí):

  • 它的最好使用的 Git 的非虛線形式的命令,這意味著你應(yīng)該更喜歡git foogit-foo。

  • 拆分短選項(xiàng)分隔單詞(喜歡git foo -a -bgit foo -ab,后者甚至可能不工作)。

  • 當(dāng)一個(gè)命令行選項(xiàng)帶有參數(shù)時(shí),請(qǐng)使用該stuck表單。換句話說,寫出git foo -oArg代替git foo -o Arg短期期權(quán),而git foo --long-opt=Arg不是git foo --long-opt Arg長(zhǎng)期期權(quán)。采用可選選項(xiàng)參數(shù)的選項(xiàng)必須寫入stuck表單中。

  • 當(dāng)您為某個(gè)命令提供修訂參數(shù)時(shí),請(qǐng)確保該參數(shù)與工作樹中文件的名稱不混淆。例如,不要寫,git log -1 HEAD而要寫git log -1 HEAD --; 如果您碰巧HEAD在工作樹中調(diào)用了一個(gè)文件,則前者不起作用。

  • 許多命令允許將一個(gè)長(zhǎng)選項(xiàng)--option僅縮寫為其唯一的前綴(例如,如果沒有其他選項(xiàng)的名稱以該名稱開頭opt,則可以拼寫--opt來調(diào)用該--option標(biāo)志),但是在編寫腳本時(shí)應(yīng)該將其完全拼出; 后來的 Git 版本可能會(huì)引入一個(gè)新的選項(xiàng),其名稱共享相同的前綴,例如--optimize,用于創(chuàng)建一個(gè)過去不再唯一的簡(jiǎn)短前綴。

增強(qiáng)的選項(xiàng)解析器

從 Git 1.5.4 系列和更進(jìn)一步,許多 Git 命令(不是所有的這些在編寫時(shí))都帶有一個(gè)增強(qiáng)的選項(xiàng)解析器。

這里是這個(gè)選項(xiàng)解析器提供的工具列表。

Magic 選項(xiàng)

具有增強(qiáng)的選項(xiàng)分析器的命令都可以理解一些神奇的命令行選項(xiàng):

-h

給出了一個(gè)完美的打印使用該命令。

$ git describe -h
usage: git describe [options] <commit-ish>*
   or: git describe [options] --dirty    --contains            find the tag that comes after the commit    --debug               debug search strategy on stderr    --all                 use any ref    --tags                use any tag, even unannotated    --long                always use long format    --abbrev[=<n>]        use <n> digits to display SHA-1s

--help-all

有些 Git 命令會(huì)使用僅用于管道的選項(xiàng)或已棄用的選項(xiàng),并且這些選項(xiàng)對(duì)于默認(rèn)用法是隱藏的。該選項(xiàng)提供了完整的選項(xiàng)列表。

否定選項(xiàng)

具有較長(zhǎng)選項(xiàng)名稱的選項(xiàng)可以通過前綴來取消--no-。例如,git branch有選項(xiàng)--trackon默認(rèn)。您可以使用--no-track來覆蓋該行為。這也是--color--no-color。

匯總短期選項(xiàng)

支持增強(qiáng)選項(xiàng)解析器的命令允許您匯總短選項(xiàng)。這意味著你可以例如使用git rm -rfgit clean -fdx。

縮寫長(zhǎng)選項(xiàng)

支持增強(qiáng)選項(xiàng)解析器的命令接受長(zhǎng)選項(xiàng)的唯一前綴,就像它完全拼出一樣,但謹(jǐn)慎使用此選項(xiàng)。例如,git commit --amen你的行為就像你輸入的一樣git commit --amend,但是只有當(dāng) Git 的一個(gè)更新版本引入了另一個(gè)共享相同前綴的選項(xiàng)時(shí),這是正確的,例如git commit --amenity選項(xiàng)。

從選項(xiàng)中分離參數(shù)

您可以在命令行中將強(qiáng)制選項(xiàng)參數(shù)作為單獨(dú)的單詞寫入選項(xiàng)。這意味著以下所有用途都有效:

$ git foo --long-opt=Arg
$ git foo --long-opt Arg
$ git foo -oArg
$ git foo -o Arg

然而,這是允許與可選的值,其中,所述開關(guān)stuck,必須使用形式:

$ git describe --abbrev HEAD     # correct
$ git describe --abbrev=10 HEAD  # correct
$ git describe --abbrev 10 HEAD  # NOT WHAT YOU MEANT

注意經(jīng)常混淆的選項(xiàng)

許多可用于工作樹中和/或索引中的文件的命令可以采用--cached和/或--index選擇。有時(shí)候人們錯(cuò)誤地認(rèn)為,因?yàn)樗饕畛醴Q為緩存,這兩個(gè)是同義詞。他們不是 - 這兩個(gè)選項(xiàng)意味著非常不同的事情。

  • --cached選項(xiàng)用于詢問通常對(duì)工作樹中的文件起作用的命令,以便與索引一起工作。例如,git grep如果在沒有提交的情況下使用,指定從哪個(gè)提交中查找字符串,通常用于工作樹中的文件,但使用該--cached選項(xiàng)時(shí),它會(huì)在索引中查找字符串。

  • --index選項(xiàng)用于要求,通常在工作中的文件工作樹的命令影響指數(shù)。例如,git stash apply通常會(huì)將存儲(chǔ)條目中記錄的更改合并到工作樹中,但是通過該--index選項(xiàng),它也會(huì)將更改合并到索引中。

git apply命令可以--cached--index(但不能同時(shí))一起使用。通常,該命令只影響工作樹中的文件,但是--index,它會(huì)對(duì)文件及其索引條目進(jìn)行修補(bǔ),而且--cached,它僅修改索引條目。

Previous article: Next article: