• # git grep

    Posté par (site web personnel) . En réponse au journal La commande ack, one step beyond grep !. Évalué à 6. Dernière modification le 02 décembre 2021 à 12:44.

    Pour les utilisateurs de git on peut aussi citer git grep qui permet facilement de rechercher dans les fichiers trackés présentant un motif donné.

    Exemples du manuel

     git grep 'time_t' -- '*.[ch]'
     Looks for time_t in all tracked .c and .h files in the working directory and its subdirectories.
     git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
     Looks for a line that has #define and either MAX_PATH or PATH_MAX.
     git grep --all-match -e NODE -e Unexpected
     Looks for a line that has NODE or Unexpected in files that have lines that match both.
     git grep solution -- :^Documentation
     Looks for solution, excluding files in Documentation.
    

    Adhérer à l'April, ça vous tente ?