Adding Only Untracked Files

前端 未结 11 1945
傲寒
傲寒 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:54

    I tried this and it worked :

    git stash && git add . && git stash pop
    

    git stash will only put all modified tracked files into separate stack, then left over files are untracked files. Then by doing git add . will stage all files untracked files, as required. Eventually, to get back all modified files from stack by doing git stash pop

提交回复
热议问题