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

命名

git-merge-base  - 為合并找到盡可能好的共同祖先

概要

git merge-base [-a|--all] <commit> <commit>…
git merge-base [-a|--all] --octopus <commit>…
git merge-base --is-ancestor <commit> <commit>git merge-base --independent <commit>…
git merge-base --fork-point <ref> [<commit>]

描述

git merge-base在兩次提交之間找到最佳共同祖先以用于三向合并。better如果后者是前者的祖先,一個共同的祖先是另一個共同的祖先。一個沒有任何更好的共同祖先的共同祖先是a best common ancestor,即a merge base。請注意,一對提交可能有多個合并基礎(chǔ)。

操作模式

作為最常見的特例,在命令行中只指定兩個提交意味著計算給定兩個提交之間的合并基礎(chǔ)。

更一般地說,在計算合并基數(shù)的兩個提交中,有一個由命令行上的第一個提交參數(shù)指定; 另一個提交是一個(可能是假設(shè)的)提交,它是命令行上所有其余提交的合并。

因此,merge base如果指定了兩個以上的提交,則不一定包含在每個提交參數(shù)中。這與使用該--merge-base選項時不同于git-show-branch [1] 。

--octopus

計算所有提交的提交的最佳共同祖先,準(zhǔn)備進(jìn)行n路合并。這模仿的行為git show-branch --merge-base。

--independent

不是打印合并基礎(chǔ),而是使用相同的祖先打印提供的提交的最小子集。換句話說,在提交的提交中,列出那些無法從其他提供的提交。這模仿的行為git show-branch --independent。

--is-ancestor

檢查第一個<commit>是否是第二個<commit>的祖先,如果為true,則退出狀態(tài)0,否則退出狀態(tài)1。錯誤通過不為1的非零狀態(tài)發(fā)出信號。

--fork-point

查找分支(或任何導(dǎo)致<commit>的歷史記錄)從另一個分支(或任何引用)<ref>分支的點。這不僅僅是尋找兩個提交的共同祖先,而且還考慮了<ref>的引用日志,以查看引用<commit>的歷史是否來自分支的早期化身<ref>(參見下面的這個模式)。

選項

-a   --all

輸出提交的所有合并基礎(chǔ),而不僅僅是一個。

討論

給定兩個提交AB,git merge-base A B將輸出一個提交這從到達(dá)AB通過父關(guān)系。

例如,對于這種拓?fù)浣Y(jié)構(gòu):

         o---o---o---B        /---o---1---o---o---o---A

AB之間的合并基礎(chǔ)是1。

鑒于三個提交AB并且C,git merge-base A B C將計算之間的合并基礎(chǔ)A和假設(shè)的承諾M,這是之間的合并BC。例如,對于這種拓?fù)浣Y(jié)構(gòu):

       o---o---o---o---C      /     /   o---o---o---B    /   /---2---1---o---o---o---A

結(jié)果git merge-base A B C1。這是因為合并相當(dāng)于拓?fù)涑兄ZM之間BC為:

       o---o---o---o---o      /                 \     /   o---o---o---o---M    /   /---2---1---o---o---o---A

結(jié)果git merge-base A M1。提交2也是之間一個共同的祖先AM,不過1是一個更好的共同的祖先,因為2是的祖先1。因此,2不是合并基礎(chǔ)。

結(jié)果git merge-base --octopus A B C2,因為2是所有提交的最佳共同祖先。

當(dāng)歷史涉及縱橫交錯時best,兩個提交可以有多個共同的祖先。例如,對于這種拓?fù)浣Y(jié)構(gòu):

---1---o---A
    \ /
     X    / \---2---o---o---B

兩個12是A的合并底座和B.既不一個比另一個(均為更好best合并堿基)。如果--all沒有給出選項,則沒有指定哪一個輸出最好。

檢查兩個提交A和B之間的“快速前進(jìn)”的常見方法是(或者至少用于)計算A和B之間的合并基礎(chǔ),并檢查它是否與A相同,在這種情況下,A是B的祖先。你會在老的腳本中看到這種習(xí)慣用法。

A=$(git rev-parse --verify A)if test "$A" = "$(git merge-base A B)"then        ... A is an ancestor of B ...fi

在現(xiàn)代的git中,你可以用更直接的方式來說明這一點:

if git merge-base --is-ancestor A B
then        ... A is an ancestor of B ...fi

代替。

討論叉點模式

topic創(chuàng)建分支之后git checkout -b topic origin/master,遠(yuǎn)程跟蹤分支的歷史origin/master可能已經(jīng)被重新卷繞和重建,導(dǎo)致這種形狀的歷史記錄:

                 o---B1                /---o---o---B2--o---o---o---B (origin/master)
        \
         B3
          \           Derived (topic)

在那里origin/master用于指向提交B3,B2,B1,現(xiàn)在它指向B,并且當(dāng)你在B3 topic時,你的分支在它的頂部被啟動origin/master。此模式使用reflog origin/master來查找B3作為分叉點,以便topic可以在更新origin/master的基礎(chǔ)上重新綁定:

$ fork_point=$(git merge-base --fork-point origin/master topic)$ git rebase --onto origin/master $fork_point topic
Previous article: Next article: