Why doesn't git commit -a add new files?

后端 未结 5 1691
挽巷
挽巷 2020-12-29 19:55

I\'m a bit new to git, and I fail to understand why git commit -a only stages changed and deleted files but not new files.

Can anyone explain why is it

5条回答
  •  鱼传尺愫
    2020-12-29 20:18

    Git is about tracking changes. It relies on you to tell it which files are important enough to track. You can achieve the desired affect like so:

    git add . ;git commit -a
    

    Make sure your .gitignore file is updated.

提交回复
热议问题