version control - How to compare two git branches and filter the differences by commit message? -


i have release branch named release/x.x.x.x contains feature branches want deploy production. release branch made on top of master current state of production.

on every release day make sure our release branch contains changes planned release. use command compare release , master branch: git log release/x.x.x.x ^master --no-merges. manually check commits keywords "shr-1234" represent ticket numbers in our ticket management system. need compare each commit list of ticket numbers identify unwanted changes.

how can filter commits returned git log release/x.x.x.x ^master --no-merges , do not contain keywords "shr-1234"? way can identify ticket number of unwanted changes.

i tried grep , awk results not useful because don't filter out whole commit.

the git log command provides 2 interesting options here:

--grep=<pattern>
       limit commits output ones log message matches specified pattern (regular expression). more 1 --grep=<pattern>, commits message matches of given patterns chosen (but see --all-match).

       when --show-notes in effect, message notes matched if part of log message.

hence --grep lets find commits do contain particular string or pattern. want commits do not contain (any or all) strings, move on to:

--invert-grep
       limit commits output ones log message not match pattern specified --grep=<pattern>.

(incidentally, note release/x.x.x.x ^master can spelled master..release/x.x.x.x. there's no machine-level reason prefer 1 on other—both wind doing same thing internally—so use whichever find more readable.)


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -