Github commit with new file

why do we need to stage new file in GIT.
i noticed i can directly commit file without staging but if the file is new in new repository, it doesn’t go for commit. Why new file needs to be staged first.

Hello Neha,

Before we make a commit, we must tell Git what files we want to commit (new untracked files, modified files, or deleted files). This is called staging and uses the add command. Why must we do this? Why can’t we just commit something directly? Let’s say you’re working on two files, but only one of them is ready to commit. You don’t want to be forced to commit both files, just the one that’s ready. That’s where Git’s add command comes in. We add files to a staging area, and then we commit what has been staged. Even the deletion of a file must be tracked in Git’s history, so deleted files must also be staged and then committed.

Thanks,
KodeKloud Support