Changes not staged for commit

In a nutshell, you will usegit addto start tracking new files and also to stage changes to already tracked files, thengit statusandgit diffto see what has been modified and staged and finallygit committo record your snapshot into your history. This will be the basic workflow that you use most of the time. In a nutshell, you will usegit addto start tracking new files and also to stage changes to already tracked files, thengit statusandgit diffto see what has been modified and staged and finallygit committo record your snapshot into your history. This will be the basic workflow that you use most of the time.

git add adds file contents to the staging area

In Git, you have to add file contents to your staging area before you can commit them. If the file is new, you can rungit addto initially add the file to your staging area, but even if the file is already "tracked" - ie, it was in your last commit - you still need to callgit addto add new modifications to your staging area. Let's see a few examples of this.

Going back to our Hello World example, once we've initiated the project, we would now start adding our files to it and we would do that withgit add. We can usegit statusto see what the state of our project is.

$ git status -s ?? README ?? hello.rb
So right now we have two untracked files. We can now add them.
$ git add README hello.rb 
Now if we rungit statusagain, we'll see that they've been added.
$ git status -s A README A hello.rb 

你可能感兴趣的:(Changes not staged for commit)