2017-11-02 8 views
1

私はgit logを使って2つのブランチの間にdiffを生成しています。私が使用している正確なコマンドは次のとおりです。コミットメッセージに基づいて特定のコミットを 'git log'で無視できますか?

git log --left-right --graph --cherry-pick --oneline sourceBranch...targetBranch 

私は思ったんだけど私はコミットメッセージに基づいてログエントリの一部を除外することができるかどうかです。たとえば、テスト自動化チームによるすべてのコミットには、特定の識別子が含まれています。TEST_AUTOと呼びます。現在、私の差分からの出力は次のようになります。

> 1e31b8x Merge pull request #1225 in base/project from feature/ABCD-1111 to master 
|\ 
| > b2f0dfx [ABCD-1111] rework help tour // fixes 
| > 270072x [ABCD-1111] rework help tour // merge fixes 
| > 98ffeax [ABCD-1111] rework help tour // merge fixes 
| > ff2e25x Merge branch 'master' into feature/ABCD-1111-rework-help-tour 
| |\ 
| > | f0daf2x [ABCD-1111] rework help tour // new menu 
| > | c519a2x [ABCD-1111] rework help tour 
| > | 6873cax [ABCD-1111] rework help tour // animations 
| > | 944cc7x [ABCD-1111] rework help tour // fix phone fullscreen 
| > | 72b3ffx [ABCD-1111] rework help tour // phone animations 
| > | 7f7c50x [ABCD-1111] rework help tour // base logic 
| > | b6dccex [ABCD-1111] rework help tour 
| > | a30022x [ABCD-1111] rework help tour // code clean up and new icons 
> | | c0a3e1x Merge pull request #11361 in base/project from TEST_AUTO-123-bring-automation-code-to to master 
|\ \ \ 
| |_|/ 
|/| | 
| > | 9837a4x [TEST_AUTO-123] Bring Android automation code to 123.X version 
| > | 41b33cx Merge branch 'feature/automation' into TEST_AUTO-951-bring-automation-code-to 
| > | bb53f6x Merge branch 'feature/automation' into TEST_AUTO-951-bring-automation-code-to 
| |\ \ 
| | > | aa1a90x [TEST_AUTO-123] Bring Android automation code to 123.X version 
| | > | 876ee8ex Merge pull request #12261 in base/project from bugfix/TEST_AUTO-789-android-fix to feature/automation 
| | |\ \ \ 
| | | > | | ef3fa1x [TEST_AUTO-456] fixed test_508() 
| | | > | | a2d352x [TEST_AUTO-456] fixed test_186 and moved to PortfolioTest 
| | | > | | 1880b0x [TEST_AUTO-456] small fix test_493 
| | | > | | facc13x [TEST_AUTO-456] fixed test_493 
| | | > | | 9ebce6x [TEST_AUTO-456] fix test_31734 (test_493) 
| | | > | | 128890x [TEST_AUTO-456] fix test_31621 (test_384) and moved to common/MediaTest 
| | | > | | ab64b8x [TEST_AUTO-456] fix test_498() 
| | | > | | 7935aax [TEST_AUTO-456] fix test_31740 (test_498) (not ready) 
| | | > | | ffb930x [TEST_AUTO-456]fixed test_31751 (test_508) and moved to common/SideMenuTest 
| | | | > | 2b810ax Merge remote-tracking branch 'remotes/origin/feature/automation' into bugfix/TEST_AUTO-789-android-fix 

これらは、私が興味を持っていないよ、ログ多くのノイズを発生させる理想的

、私は比較からコミットを除外したいと思います。これにはTEST_AUTO文字列が含まれています。私は上記のコマンドを 'grep -v'にパイプしてみましたが、それはそれを含む行を(明らかに)削除して、ツリーに奇妙なギャップを残します。私はそれらが全く含まれないようにしたい。 man git logから

+2

あなたはhttps://git-scm.com/docs/git-log#git-log([ '--invert-grep']を試してみました--- invert-grep)? – JDB

+1

うん、 '--grep = 'と '--invert-grep'を使ってください。 –

+0

--invert-grepオプションが表示されませんでしたが、完全に機能しました。あなたが答えとしてそれを投稿するなら、私はそれを受け入れるでしょう。ありがとう! – AWT

答えて

3

git log --invert-grep --grep=TEST_AUTO

--invert-grep 
     Limit the commits output to ones with log message that do not match the pattern specified with --grep=<pattern>. 
関連する問題