Up and Running with Git Transcripts
Chapter: The '6' core git operations
Lecture: Commit and add
0:00 The next two commands to think about our add and commit.
0:04 Now here's a big picture of our computer that let's just talk about the work flow
0:09 a little bit the different stages that files can go through in git remember at the
0:14 beginning I said this distributed version control gives us lots of power with the added complexity
0:20 of just a little bit of complexity.
0:21 Well, it's a little bit here.
0:23 So our files can go through these different stages or states.
0:28 They start out as untracked. That means git doesn't care about them.
0:32 They might be in the folder but it's not going to commit them or do anything
0:35 to them. Then we have staged,
0:38 which is, here's a new file that we told git in the next commit.
0:42 We want to be committed but is not yet committed.
0:44 It's basically tracked. And then there's stuff that is saved into source control.
0:49 As far as we're concerned, it's committed.
0:53 We also have this other status of not yet staged but tracked.
0:57 That's like added but not yet pushed in.
1:01 Okay, now we can go from untracked,
1:04 we add a new item and now it's staged or we can have some changes that
1:09 were a previous file that getting new about that we opened and made some changes to
1:14 And we also have to actively add those changes in to git we have to
1:20 say I edited that file and when I do a commit,
1:22 I do want that, those parts that I changed over there also included.
1:27 So there's this sort of not staged but edited and then staged for being committed.
1:33 And then finally, when you've done a bunch of work and you sort of coordinated
1:36 everything that all of this work,
1:38 this is all ready to go in.
1:39 As one change to the software,
1:41 it gets added through a commit to get saved to a commit.
1:46 It's really important to realize all of this is happening on your computer add and commit
1:51 have nothing to do with some hosting server.
1:54 It's completely unaware of the fact that these changes are happening.
1:58 Other people working on their copy,
2:01 their clone of the repository, they won't see this,
2:04 they won't know about it. There's not a way to like lock a file while
2:07 you're working on it. This is entirely add and,
2:10 commit a local thing that happens on your clone.
2:12 So when you commit it, it just commits back here.
2:15 It doesn't do anything to coordinate with the other users of this repository.