简体   繁体   中英

Git - Why this command does not add the file in my repository?

I am using git and most of the time we use this command to add files in our repository. git add . and after that we write a commit message like this git commit -m "add file info.js" . But I came across with this command git commit -am "message" . If I have not created a new file this will stage the commit and send the commit with a message.

But If I create a new file like file.js the command does push the latest code on my repository but not the new file. I wonder why. Can somebody please explain me.

Because some of your files are not staged. This happens when you delete/add files that are not currently being tracked.

-a documentation:

Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.

Eventually you would need to do still a git add . when you add/delete files that are not currently being tracked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM