Git でブランチ構造だけを表示する方法はありますか? コミットをグラフィカルに表示するツールはいくつかありますが、私の場合、リストが長すぎて構造がわかりません。git-log が答えになると思いますが、分岐コミットのみを表示するスイッチが見つかりません。これと「--graph --branches --oneline --all」を併用するとうまくいく可能性があります。
編集:Ubuntuでこれを行う方法を探しています。
Git でブランチ構造だけを表示する方法はありますか? コミットをグラフィカルに表示するツールはいくつかありますが、私の場合、リストが長すぎて構造がわかりません。git-log が答えになると思いますが、分岐コミットのみを表示するスイッチが見つかりません。これと「--graph --branches --oneline --all」を併用するとうまくいく可能性があります。
編集:Ubuntuでこれを行う方法を探しています。
「分岐構造」の意味がよくわかりません。
git log
コミットによって作成されたブランチを視覚化するのに役立ちます (このブログ投稿を参照してください):
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
しかし、異なる HEAD ブランチのみが必要な場合は、次の行に沿って何かを試すことができます。
heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'"
( を使用しcolumn command
、ここでは最後のコミット以降のコミットのみorigin/master
)
注: Jakub Narębskiはオプションの追加を 推奨しています。彼の回答--simplify-by-decoration
を参照してください。
おそらく必要なのは--simplify-by-decoration
オプションです。git logドキュメントを参照してください。
--装飾による単純化
いくつかのブランチまたはタグによって参照されるコミットが選択されます。
だからそうなるだろう
git log --graph --simplify-by-decoration --all
または次のVonC回答
git log --graph --simplify-by-decoration \
--pretty=format:'%Cred%h%Creset-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' \
--abbrev-commit --date=relative
多分私は何かが欠けているかもしれませんが、gitk --all
まだ誰も言及していないようです.
基本的な解決策は次のとおりです。
git log --graph --all
もっと派手にしたい場合:
git log --graph --all --pretty=format:"%Cblue%h%Creset [%Cgreen%ar%Creset] %s%C(yellow)%d%Creset"
macOS を使用している場合はgitx
macOS または Windows 用のsmartgit (ただし、使用したことはありません)
git-guiは、ネイティブの git gui (クロスプラットフォーム) を使用します
特定のブランチがリポジトリおよびリモート内の他のブランチとどのように関連しているかについての詳細を取得するgit wtf
には、William Morgan によるアドオン スクリプトを使用できます: http://git-wt-commit.rubyforge.org/
次のような要約情報が生成されます。
$ git wtf
Local branch: master
[x] in sync with remote
Remote branch: origin/master (git@gitorious.org:willgit/mainline.git)
[x] in sync with local
Feature branches:
{ } origin/experimental is NOT merged in (1 commit ahead)
- some tweaks i'm playing around with [80e5da1]
{ } origin/dont-assume-origin is NOT merged in (1 commit ahead)
- guess primary remote repo from git config instead of assuming "origin" [23c96f1]
(上記の URL からの例)。