Adding Only Untracked Files

前端 未结 11 1905
傲寒
傲寒 2020-12-07 07:04

One of the commands I find incredibly useful in Git is git add -u to throw everything but untracked files into the index. Is there an inverse of that? In the la

11条回答
  •  抹茶落季
    2020-12-07 07:46

    You can add this to your ~/.gitconfig file:

    [alias]
        add-untracked = !"git status --porcelain | awk '/\\?\\?/{ print $2 }' | xargs git add"
    

    Then, from the commandline, just run:

    git add-untracked
    

提交回复
热议问题