Recursively add files by pattern

前端 未结 11 1377
予麋鹿
予麋鹿 2020-11-28 18:18

How do I recursively add files by a pattern (or glob) located in different directories?

For example, I\'d like to add A/B/C/foo.java and D/E/F/bar

11条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-28 18:54

    put line in ~/.gitconfig

    [alias] addt = !sh -c 'git ls-files | grep \"\\.$1*\" | xargs git add' -

    If you want to add all modified java file can just do: git addt java

    Samely, if you want to add all modified python file can just do: git addt py

提交回复
热议问题