git: list new files only

前端 未结 6 1685
眼角桃花
眼角桃花 2020-12-23 13:54

When I do a git status I get a list of files prefixed with new file: . How can I get only this list? I want to process this files in a simple loop

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-23 14:26

    Instead of parsing the output of "git status", it is probably more elegant to use

    git ls-files -o  --exclude-standard
    

    As with git status, ls-files will produce output relative to your currrent working directory.

    You may wish to include the --full-name option:

    git ls-files -o  --exclude-standard --full-name
    

提交回复
热议问题