セットアップと設定
プロジェクトの取得と作成
基本的なスナップショット
ブランチとマージ
プロジェクトの共有と更新
検査と比較
パッチ適用
デバッグ
メール
外部システム
サーバー管理
ガイド
- gitattributes
- コマンドラインインターフェースの規約
- 日常的なGit
- よくある質問 (FAQ)
- 用語集
- フック
- gitignore
- gitmodules
- リビジョン
- サブモジュール
- チュートリアル
- ワークフロー
- すべてのガイド...
管理
低レベルコマンド
- 2.1.4 → 2.47.0 変更なし
-
2.0.5
12/17/14
説明
<head>..<upstream>
の範囲にあるコミットが、<limit>..<head>
の範囲にあるコミットと同等かどうかを判断します。
同等性のテストは、空白と行番号を削除した後の diff に基づいています。したがって、git-cherry は、git-cherry-pick[1]、git-am[1]、または git-rebase[1] によってコミットが「コピー」されたことを検出します。
<limit>..<head>
内のすべてのコミットの SHA1 を出力します。<upstream> に同等のコミットがある場合は -
、ない場合は +
が前に付きます。
例
パッチワークフロー
git-cherry は、パッチベースのワークフロー(gitworkflows[7] を参照)で、一連のパッチがアップストリームメンテナによって適用されたかどうかを判断するためによく使用されます。このようなワークフローでは、次のようにトピックブランチを作成して送信する場合があります
$ git checkout -b topic origin/master # work and create some commits $ git format-patch origin/master $ git send-email ... 00*
後で、(まだ topic
にいる状態で)変更が適用されたかどうかを確認できます
$ git fetch # update your notion of origin/master $ git cherry -v
具体的な例
topic が 3 つのコミットで構成され、メンテナがそのうちの 2 つを適用した場合、状況は次のようになります
$ git log --graph --oneline --decorate --boundary origin/master...topic * 7654321 (origin/master) upstream tip commit [... snip some other commits ...] * cccc111 cherry-pick of C * aaaa111 cherry-pick of A [... snip a lot more that has happened ...] | * cccc000 (topic) commit C | * bbbb000 commit B | * aaaa000 commit A |/ o 1234567 branch point
このような場合、git-cherry は、まだ適用されていない内容の簡潔な概要を表示します
$ git cherry origin/master topic - cccc000... commit C + bbbb000... commit B - aaaa000... commit A
ここで、コミット A と C(-
でマークされている)は、origin/master
の上にリベースするときに topic
ブランチから削除できますが、コミット B(+
でマークされている)は、origin/master
に適用するために送信されるように、まだ保持する必要があります。
制限の使用
オプションの <limit> は、トピックがアップストリームにない他の作業に基づいている場合に役立ちます。前の例を拡張すると、次のようになります
$ git log --graph --oneline --decorate --boundary origin/master...topic * 7654321 (origin/master) upstream tip commit [... snip some other commits ...] * cccc111 cherry-pick of C * aaaa111 cherry-pick of A [... snip a lot more that has happened ...] | * cccc000 (topic) commit C | * bbbb000 commit B | * aaaa000 commit A | * 0000fff (base) unpublished stuff F [... snip ...] | * 0000aaa unpublished stuff A |/ o 1234567 merge-base between upstream and topic
base
を制限として指定することにより、base
と topic
の間のコミットをリストすることを避けることができます
$ git cherry origin/master topic base - cccc000... commit C + bbbb000... commit B - aaaa000... commit A
GIT
git[1] スイートの一部