It is necessary to obtain a list of changed files, while displaying only those that match the existing ones.

There is a command with parameters: git log --name-only , which lists the modified files, but there are a lot of them. I have my own list of files (tables, packages, etc.), can I somehow compare them, so that ultimately only those objects that match when compared are displayed?


moved from comment:

I work in ms / windows using GIT BASH.

In this case, you need to show Oracla objects, such as view, tables, packages. For example, the output of the command

 git log --name-only 

shows the author of the commit, the date, the comment and the file itself with the path

 rollback/oracle/scheme/tables/T_COL_NAMES.sql rollback/oracle/scheme/tables/T_NUM_VAL.sql 

Objects (parts of the file name) are: T_COL_NAMES and T_NUM_VAL , and there are a lot of such. But I have a list of mine. Suppose my object is T_NUM_VAL .

How can I set my objects (part of the file name) so that the team will output only them and weed out the rest?

  • If you are sitting under linux, then try the grep utility - Andrew Bystrov
  • what are the objects in git? - KoVadim
  • I assume that the git status command is being searched. possibly with the --untracked-files=no option. // but still it is better to specify the question. An example of some lead that is required. - aleksandr barakin
  • I sit under Windows I work through GIT BASH. In this case, you need to pull out objects of Oracla such as view, tables, packages. For example, the output of the git log --name-only command shows the author of the commit, the date, the comment and the object itself with the path: rollback / oracle / scheme / tables / T_COL_NAMES.sql rollback / oracle / scheme / tables / T_NUM_VAL.sql The objects are: T_COL_NAMES and T_NUM_VAL and there are a lot of such, but I have a list of my own. Suppose my object is T_NUM_VAL. How can I set my objects so that it displays only them, and the rest are eliminated? I don't understand this ... - Andrey Poznyakovsky

1 answer 1

to display information about commits in which files containing the names of, for example, the lines T_COL_NAMES and T_NUM_VAL , were T_NUM_VAL , you can use something like this ( -- to separate options from parameters that can begin, like options, with the - symbol):

 $ git log -- *T_COL_NAMES* *T_NUM_VAL* 

and in order for the file names themselves to be included in the output, you need to add (as you already did) the option --name-only :

 $ git log --name-only -- *T_COL_NAMES* *T_NUM_VAL* 

or even --name-status - in this case before the file name will be the symbol: M - modified. A - added, D - deleted (deleted), etc .:

 $ git log --name-status -- *T_COL_NAMES* *T_NUM_VAL* 

see the git log documentation for details. in particular, regarding the status notation of files - in the description of the option --diff-filter .