Hey man, appreciate your video but unfortunately it’s not technically accurate. Index contains not just modified or new files. It contains ALL files that go into next commit. You don’t have to explicitly add unmodified files since by default index starts out matching previous commit. This explains why you have to remove a file from index if you don’t want it to be part of next commit. (Removing from working directory does nothing as far as git is concerned.) Also, when you add a file to index, git does much more than just record its pathname. It creates an internal copy of the file (a so-called blob), and it is that copy that the index references. This explains why modified files have to be re-added to index (even though their pathname is already in the index).
You're hired! Yes, what you say is correct. I indeed glossed over the more technical aspects to simplify the concept, but you are 100% correct. Maybe I'll re-record this and focus on what's technically going on below the covers.
It's a common confusion when people start out with git, but eventually you just get used to using the git add command and staging files before a commit.
Thank you sir for the wonderful video we love all your git videos so much it taught us so much, thanks again sir
Thanks so much!
Hey man, appreciate your video but unfortunately it’s not technically accurate. Index contains not just modified or new files. It contains ALL files that go into next commit. You don’t have to explicitly add unmodified files since by default index starts out matching previous commit.
This explains why you have to remove a file from index if you don’t want it to be part of next commit. (Removing from working directory does nothing as far as git is concerned.)
Also, when you add a file to index, git does much more than just record its pathname. It creates an internal copy of the file (a so-called blob), and it is that copy that the index references. This explains why modified files have to be re-added to index (even though their pathname is already in the index).
You're hired! Yes, what you say is correct. I indeed glossed over the more technical aspects to simplify the concept, but you are 100% correct. Maybe I'll re-record this and focus on what's technically going on below the covers.
Never understood why we had to do git add all the time and add things to the git index. Makes no sense to me.
It's a common confusion when people start out with git, but eventually you just get used to using the git add command and staging files before a commit.