Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie we are going to use Git to start tracking changes inside our explore_california project. Now, the project already has a number of files in it, but Git is not being used to track them right now, right now Git does not have any knowledge about them, there is no repository established to keep track of these files, it's just a set of files at the moment. To bring Git into play, we need to switch to the directory. Now, you can see I am in first_git_project, I'll go backwards a directory, and you can see here's the explore_california project. And I am going to go inside that folder, and let's just go ahead and take a look at the listing.
You will notice that it doesn't have a .git folder up here, it does have .DS_Store, ignore that, that's just a small file that the Macintosh uses to keep track of some basic file information. We can also do git status, and you will see that it comes up and says, oops, this is not a Git repository or any of the parent directory, so it actually goes up and tries all the parent directories above it to the top of the hard drive looking for that .git folder, and it said, nope, couldn't find it anywhere, so this must not be a Git repository. We remember how to initialize repository, right? It's git init, and once we do that, now we have this .git file inside our project directory, and that's where all of the tracking information about these files is going to be.
Now if we do git status, you can see that it comes up and tells us about all the untracked files that are in there. Before we add those to it, let's first do a git log and just see what that does. Git log comes up and says oops, the HEAD doesn't point to anywhere useful yet, that's basically what it's telling us that HEAD isn't pointing anywhere useful, and it's trying to find the HEAD because remember the HEAD points to the last commit. Well, there hasn't been a commit yet, so HEAD hasn't been established, and that really just happens right when you first initialize your project. Once we make our first commit, then it will all be there.
So to make our commit, we'll do git add, and we'll do the entire directory, git add everything that we've got using that dot, everything that's in this current directory. git status will show us all of those things, you can see it's a whole lot of stuff, that's all going in there, all these new files. Typically if you're first starting with a new project, and you've got existing files, this is what it's going to look like and typically you also just do get commit -m, and you can just call it Initial commit. So there it is it created a whole bunch of files.
You can scroll up if you want to see the sum total of what it did, 69 files changed, and it gave us a commit now, so now we have git log shows us something useful that shows us our Initial commit. Before we move onto making changes, I just want to make sure that one thing is super clear to you, which is that the explore_california repository and the first_git_project repository are completely separate. Remember, all the repository information is stored in that .git folder at the top level of those two directories, so the two are completely separate. So here we have git log for what's inside the explore_california project.
If I go backwards and go into my first_git_project, do git log there, you can see all the things that are in that project. Go back into explore_california, and I'll do git log again, and you can see that it is just that Initial commit. So that may have been obvious to you, but I just want to make sure that's super clear that the two are completely separate, and that you can have as many Git repositories as you like on your computer. So if you're working with 20 different web sites, you can have 20 different folders and each one can be its own Git repository, and it's no big deal to just move between them and each one contains the information about what has changed in that repository, that is absolutely common.
Just don't make the mistake of thinking that anything that you do in one project has something to do with what happens inside the other repository, they are each separate. Now that we have told Git that it should start tracking files, and we have given it its first set of files that it should track from, we are ready to start making edits to our project, and that's what we'll do in the next movie.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 103109 Viewers
61 Video lessons · 89753 Viewers
71 Video lessons · 73392 Viewers
56 Video lessons · 104953 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.