Make your first commit using Git.
- [Announcer] So in order to track our changes, we first have to make some changes. And so since we don't have any existing files inside of this directory, our first change is going to be add a file. So let's do that. I'm going to do this using a source code editor, not a word processor, a source code editor. I'm going to be using the Atom text editor. You can also use Notepad, or a number of other code editors. It doesn't really matter. We just want something that's going to be raw text and not have all the formatting information of a word processor. So, let's create this file and just say "This is my first file." And I'm going to then save that file and for the save option I'm going to put it inside that first Git project and I'm just going to call it first_file.txt. Okay. So now it's saved in there. Let's just hide that window and come over here and take a look. You can see that it's in there. first_file.txt. So now that we've made a change to our project, we want Git to track of the fact that we just made a change. And we're going to do that using git space add, and then a space, and then I'm going to use a period. Period is a short hand for the current directory. I'm basically saying, "Hey git, add all changes that are in the current directory." Now when we tell Git to add the changes, it isn't actually tracking them yet. It hasn't made those permanent. In order to do that we need to commit them. So we use git space commit and then a space and then we use -m, short for message, and then in quotes I'm going to put the message that I want to go with it. I'm just going to make it "Initial commit". So inside quotes, I've got my message so I'm now saying Okay, all those things you added and you're prepared to commit, now we want to actually commit them and track them, forever. So once I hit commit, it comes up and says, yep, you've made your commit, it gives me some information about it. This is the basic process we're going to be using over and over again with Git. First, you're going to make whatever changes you want, then you're going to add the changes and then commit the changes to the repository with a message. Those three steps are going to play out over and over again. There's going to be some options and some complexity to those that we're going to learn later on, but the fundamental part of Git is exactly that. Make whatever changes you want, add them, then commit them with a message.
- Exploring the history of version control
- Installing Git on Mac, Windows, and Linux
- Initializing a repository
- Writing useful commit messages
- The Git three-tree architecture
- Tracking when files are added, edited, deleted, or moved
- Viewing change sets and comparing versions
- Undoing changes and retrieving previous versions
- Ignoring changes to select files