Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialvamosrope14
14,932 PointsI still don't understand why a deleted file is not sent to the stages for commit?
.
2 Answers
Jamie Reardon
Treehouse Project ReviewerOnly modified files go to the staging area, via the git add subcommand. When you make changes to a file, it's "modified". Therefore, when you add them via the git add subcommand, you are adding them to the staging area/cache.
When using the git rm or mv subcommands, they will go straight to the changes to be committed section.
Tiago Ferrão
10,873 Pointshowever i tried git add . and the file shows on the
rm git.html ➜ temp_git git:(master) ✗ git status On branch master Changes not staged for commit: (use "git add/rm <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: git.html no changes added to commit (use "git add" and/or "git commit -a")
➜ temp_git git:(master) ✗ git add . ➜ temp_git git:(master) ✗ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage)
deleted: git.html
considering the above, what is the difference between git rm or git add ?
vamosrope14
14,932 Pointsvamosrope14
14,932 Points.
Jamie Reardon
Treehouse Project ReviewerJamie Reardon
Treehouse Project ReviewerYes that is correct Amandeep. Like I said, only "modified"/new files go to the staging area, via the git add subcommand. Deleted and moved files are not counted as modified.
You can review this whole process on an earlier video in the first stage of this course, "First Commits". I have almost finished this course and I have been making notes on most of the videos :)