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

目錄 搜索
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
文字

命名

gitcli  -  Git 命令行界面和約定

概要

gitcli

描述

本手冊介紹了在整個 Git CLI 中使用的約定。

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

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

  • 當一個論證可能會被誤解為一個修訂或一條路徑時,他們可以通過放在--它們之間來消除歧義。例如git diff -- HEAD,“我的工作樹中有一個名為 HEAD 的文件,請在索引中的版本I和我在該文件的工作樹中顯示的內(nèi)容之間顯示更改”,而不是“顯示 HEAD 提交與工作之間的差異樹整體“。你可以說git diff HEAD --要問后者。

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

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

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

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

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

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

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

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

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

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

增強的選項解析器

從 Git 1.5.4 系列和更進一步,許多 Git 命令(不是所有的這些在編寫時)都帶有一個增強的選項解析器。

這里是這個選項解析器提供的工具列表。

Magic 選項

具有增強的選項分析器的命令都可以理解一些神奇的命令行選項:

-h

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

$ 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 命令會使用僅用于管道的選項或已棄用的選項,并且這些選項對于默認用法是隱藏的。該選項提供了完整的選項列表。

否定選項

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

匯總短期選項

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

縮寫長選項

支持增強選項解析器的命令接受長選項的唯一前綴,就像它完全拼出一樣,但謹慎使用此選項。例如,git commit --amen你的行為就像你輸入的一樣git commit --amend,但是只有當 Git 的一個更新版本引入了另一個共享相同前綴的選項時,這是正確的,例如git commit --amenity選項。

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

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

$ 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)?;煜倪x項

許多可用于工作樹中和/或索引中的文件的命令可以采用--cached和/或--index選擇。有時候人們錯誤地認為,因為索引最初稱為緩存,這兩個是同義詞。他們不是 - 這兩個選項意味著非常不同的事情。

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

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

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

上一篇: 下一篇: