亚洲国产日韩欧美一区二区三区,精品亚洲国产成人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

Name

git-branch  - 列出,創(chuàng)建或刪除分支

概要

git branch [--color[=<when>] | --no-color] [-r | -a]        [--list] [-v [--abbrev=<length> | --no-abbrev]]        [--column[=<options>] | --no-column] [--sort=<key>]        [(--merged | --no-merged) [<commit>]]        [--contains [<commit]] [--no-contains [<commit>]]        [--points-at <object>] [--format=<format>] [<pattern>…]git branch [--set-upstream | --track | --no-track] [-l] [-f] <branchname> [<start-point>]git branch (--set-upstream-to=<upstream> | -u <upstream>) [<branchname>]git branch --unset-upstream [<branchname>]git branch (-m | -M) [<oldbranch>] <newbranch>git branch (-d | -D) [-r] <branchname>…
git branch --edit-description [<branchname>]

描述

如果--list給出,或者如果沒有非選項參數(shù),則列出現(xiàn)有分支; 當前分支將突出顯示星號。選項-r會導致遠程追蹤分支被列出,選項-a顯示本地和遠程分支。如果<pattern>給出a,則將其用作外殼通配符,以將輸出限制為匹配的分支。如果給出多個模式,則顯示一個分支,如果它匹配任何模式。請注意,提供時<pattern>,您必須使用--list; 否則該命令被解釋為分支創(chuàng)建。

--contains,僅顯示包含指定提交的分支(換句話說,其提示提交的分支是指定提交的后代),將其--no-contains反轉。使用時--merged,只會將分支合并到指定的提交中(即,其提交提交可從指定的提交中獲得的分支)將被列出。隨著--no-merged唯一分支機構不合并到一個名為承諾將陸續(xù)上市。如果缺少<commit>參數(shù),則默認為HEAD(即當前分支的尖端)。

命令的第二種形式創(chuàng)建一個名為<branchname>的新分支頭,它指向當前HEAD或<start-point>(如果給出)。

請注意,這將創(chuàng)建新的分支,但不會將工作樹切換到它; 使用“git checkout <newbranch>”切換到新分支。

當一個本地分支從一個遠程跟蹤分支啟動時,Git設置分支(特別是branch.<name>.remotebranch.<name>.merge配置條目),以便git pull從遠程跟蹤分支適當合并。此行為可能通過全局branch.autoSetupMerge配置標志進行更改。該設置可以通過使用--track--no-track選項來覆蓋,并在稍后使用git branch --set-upstream-to

使用-m-M選項,<oldbranch>將被重命名為<newbranch>。如果<oldbranch>具有相應的reflog,則將其重命名為匹配<newbranch>,并且會創(chuàng)建reflog條目以記住分支重命名。如果<newbranch>存在,-M必須用于強制重命名發(fā)生。

帶有-d-D選項,<branchname>將被刪除。您可以指定多個分支進行刪除。如果分支當前有reflog,則reflog也將被刪除。

使用-r連同-d刪除遠程跟蹤分支。請注意,如果遠程跟蹤分支不再存在于遠程存儲庫中,或者git fetch已配置為不再獲取它們,則僅刪除遠程跟蹤分支是有意義的。另請參閱prunegit-remote [1] 的子命令,以清除所有過時的遠程跟蹤分支。

選項

-d   --delete

刪除分支。該分支必須完全合并到其上游分支中,或者HEAD如果沒有上游設置為--track--set-upstream。

-D

快捷鍵--delete --force。

-l   --create-reflog

創(chuàng)建分支的reflog。這將激活對分支ref的所有更改的記錄,從而可以使用基于日期的sha1表達式,如“<branchname> @ {yesterday}”。請注意,在非裸倉庫中,configlog core.logAllRefUpdates選項通常默認啟用reflog 。否定形式--no-create-reflog只會覆蓋較早的形式--create-reflog,但目前并不否定這種設置core.logAllRefUpdates。

-f   --force

如果<branchname>已存在,請將<branchname>重置為<startpoint>。沒有-f git branch拒絕改變現(xiàn)有的分支。結合-d(或--delete),允許刪除分支,而不考慮其合并狀態(tài)。結合-m(或--move),即使新分支名稱已存在,也允許重命名分支。

-m   --move

移動/重命名分支和相應的reflog。

-M

快捷鍵--move --force。

--color=<when>

顏色分支突出顯示當前,本地和遠程跟蹤分支。該值必須始終(默認),永不,或自動。

--no-color

關閉分支顏色,即使配置文件將默認設置為顏色輸出。和...一樣--color=never。

-i   --ignore-case

排序和過濾分支不區(qū)分大小寫。

--column=<options>   --no-column

在列中顯示分支列表。有關選項語法,請參閱配置變量column.branch。--column--no-column不帶選項相當于alwaysnever分別。

該選項僅適用于非詳細模式。

-r   --remotes

列出或刪除(如果與-d一起使用)遠程跟蹤分支。

-a   --all

列出遠程追蹤分行和當?shù)胤中小?/p>

--list

列出分支。使用可選項<pattern>...,例如git branch --list 'maint-*',僅列出與模式匹配的分支。

這不應與此混淆git branch -l <branchname>,它會創(chuàng)建一個以<branchname>reflog 命名的分支。詳情見--create-reflog上文。

-v   -vv   --verbose

在列表模式下,顯示sha1并為每個頭提交主題行,以及與上游分支(如果有)的關系。如果給出兩次,也打印上游分支的名稱(另請參閱git remote show <remote>)。

-q   --quiet

創(chuàng)建或刪除分支時更安靜,抑制非錯誤消息。

--abbrev=<length>

改變輸出列表中sha1的最小顯示長度。默認值是7,可以由core.abbrevconfig選項覆蓋。

--no-abbrev

在輸出列表中顯示完整的sha1,而不是縮寫它們。

-t   --track

創(chuàng)建新分支時,設置branch.<name>.remotebranch.<name>.merge配置條目以將起點分支標記為新分支的“上游”。這個配置會告訴git顯示in git status和in兩個分支之間的關系git branch -v。此外,它在git pull沒有參數(shù)的情況下指示新分支簽出時從上游撤出。

當起始點是遠程跟蹤分支時,此行為是默認行為。false如果需要git checkout,git branch可以將branch.autoSetupMerge配置變量設置為并且始終表現(xiàn)得像--no-track給定的一樣。always如果您想在起點為本地或遠程跟蹤分支時想要此行為,請將其設置為。

--no-track

即使branch.autoSetupMerge配置變量為true,也不要設置“上游”配置。

--set-upstream

如果指定的分支尚不存在或者--force已經(jīng)給出,則完全相同--track。否則,--track在創(chuàng)建分支時設置配置,除非分支指向的地方不更改。

-u <upstream>   --set-upstream-to=<upstream>

設置<branchname>的跟蹤信息,以便<upstream>被視為<branchname>的上游分支。如果未指定<branchname>,則默認為當前分支。

--unset-upstream

刪除<branchname>的上游信息。如果未指定分支,則默認為當前分支。

--edit-description

打開一個編輯器,編輯文本解釋分支是干什么用的,通過其他各種命令使用(例如format-patch,request-pullmerge(如果啟用))??梢允褂枚嘈薪忉?。

--contains <commit>

只列出包含指定提交的分支(如果未指定,則為HEAD)。意味著--list。

--no-contains <commit>

只列出不包含指定提交的分支(如果未指定,則為HEAD)。意味著--list。

--merged <commit>

僅列出可從指定提交中獲得提示的分支(如果未指定,則為HEAD)。暗示--list,不符合--no-merged。

--no-merged <commit>

僅列出提示無法從指定提交中獲得的分支(如果未指定,則為HEAD)。暗示--list,不符合--merged。

<branchname>

要創(chuàng)建或刪除的分支的名稱。新的分支名稱必須通過由git-check-ref-format [1]定義的所有檢查。其中一些檢查可能會限制分支名稱中允許的字符。

<start-point>

新的分支頭將指向這個提交。它可以作為分支名稱,提交標識或標簽給出。如果省略此選項,則將使用當前的HEAD。

<oldbranch>

要重命名的現(xiàn)有分支的名稱。

<newbranch>

現(xiàn)有分支的新名稱。與<branchname>相同的限制適用。

--sort=<key>

根據(jù)給定的關鍵字進行排序。前綴-按值的降序進行排序。您可以多次使用--sort = <key>選項,在這種情況下,最后一個鍵變?yōu)橹麈I。支持的密鑰與中的密鑰相同git for-each-ref。排序順序默認為基于完整的refname(包括refs/...前綴)排序。這將首先列出分離的HEAD(如果存在),然后列出當?shù)胤种Ш妥罱K遠程跟蹤分支。

--points-at <object>

只列出給定對象的分支。

--format <format>

%(fieldname)從顯示的分支ref 中插入的字符串以及它指向的對象。格式與git-for-each-ref [1]的格式相同。

例子

從已知標簽開始開發(fā)

$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6$ cd my2.6$ git branch my2.6.14 v2.6.14   (1)$ git checkout my2.6.14
  1. 這一步和下一步可以合并成一個單步執(zhí)行“checkout -b my2.6.14 v2.6.14”。刪除一個不需要的分支$ git clone git://git.kernel.org/.../git.git my.git $ cd my.git $ git branch -d -r origin / todo origin / html origin / man(1 )$ git branch -D test(2)

2. 刪除遠程追蹤分支“todo”,“html”和“man”。下一個fetchpull將再次創(chuàng)建它們,除非您將它們配置為不再。參見git-fetch [1]。

3. 即使“主”分支(或當前選中的分支)沒有提交來自測試分支的所有提交,也要刪除“測試”分支。注意如果您正在創(chuàng)建要立即簽出的分支,則它更易于使用其Git的checkout命令-b選項來創(chuàng)建一個分支,并檢查它與單一command.The選項--contains,--no-contains,--merged--no-merged服務四個相關但不同的目的:

4. --contains <commit> 用于查找所有需要特別注意的分支,因為這些分支包含指定的<commit>。

  • --no-contains <commit> 是相反的,即不包含指定的<commit>的分支。

  • --merged 用于查找可以安全刪除的所有分支,因為這些分支完全由HEAD包含。

  • --no-merged 用于查找合并到HEAD中的候選分支,因為這些分支未被HEAD完全包含。

Previous article: Next article: