Is it possible to reduce "git show -name-status -oneline master" to just the final line?

In the next release, I would like to exclude lines beginning with "A" or "M". Is it possible?

 $ git show --name-status --oneline master
    4e8f3e9 Added: f1.txt, f2.txt; modified: master_1.txt
    A       f1.txt
    A       f2.txt
    M       master_1.txt

      

Using "-summary" helps, but it still leaves "extra" things in it:

$ git show --summary --oneline master
4e8f3e9 Added: f1.txt, f2.txt; modified: master_1.txt
 create mode 100644 f1.txt
 create mode 100644 f2.txt

      

What I found interesting is that although "--oneline" is specified, the output is definitely not limited to one line! :)

While it is possible to process the output, for example pipe it through "grep -v" to get the desired output (as suggested below), I am looking for a solution that is strictly based on git options.

+3


source to share


2 answers


The log message itself is one line, in addition, the name status line is requested.

" Added: f1.txt, f2.txt; modified: master_1.txt

" is just (one line) of git text copied from the commit message. If you don't want it to show the name and status of the changed files, do

git show -s --oneline master   # `-s` is short for `--no-patch`

      



because the default for showing a commit is to split the patch unless you tell it something else.

I see the git docs, umm, are not organized in the best way to easily find what -s

.,.

+1


source


You can use grep -v

to delete all lines starting with "A" or "M":



git show --name-status --oneline master | grep -v '^[A,M]'

      

+1


source







All Articles