Watching:

Perform Your First Commit with Git


show more Performing your first commit provides you with in-depth training on Developer. Taught by Kevin Skoglund as part of the Git Essential Training show less
please wait ...

Performing your first commit

Now that we have initialized our project, we are ready to make our first commit that is to tell Git to track the first change. So we need to do something to our project, to make a change so that it can track it. So what we are going to do to start with is create a new file. So I am going to do that using TextMate, you can use any text editor--again that's a basic text editor, not a word processor to do this. So I'll open up TextMate, and I am just going to create a new file, I am going to say, This is my first file, and then I am going to choose Save, and then I'll just call it first_file.txt, and I'll just put it on the Desktop for now. All right.

So now I've got this first file, I am going to move it in my project, so there it is. Now I have made a change to my project, I have added a file, that's the change that's been made. So now what I want to do is switch over to the command line and tell Git to add all changes that have been made to this entire project, everything that's been made, and I do that with the dot, dot is short for, this directory. I am already inside my project directory first_git_project, so git add every change that's been made inside this directory, and now, I am going to commit that change, tell Git to put it in permanent memory, to put it in the repository. So git commit, and then I am going to give it a message, -m and in quotes I am going to put "Initial commit".

Now I could put something more specific in there, but this is going to be good enough to get us started, this is just a simple message telling it that it's going to make this commit, and you can see that it did one file change, one insertion, create mode, first_file, so now it has added that to our project. Now we have just tracked our first change in Git. So this is the basic process that we are going to follow throughout working with Git. It's really quite simple, you just make your changes, then you add the changes, and then you commit the changes to the repository with a message, and that's it. That's really the basic cycle that we are going to be following, make changes, add the changes, commit the changes.

Now of course, there is a lot more going on with each one of these steps and a lot of options and other things that we can do, but this is the basic flow of making commits that we are going to be doing over and over and over.

Performing your first commit
Video duration: 2m 4s 6h 25m Beginner

Viewers:

Performing your first commit provides you with in-depth training on Developer. Taught by Kevin Skoglund as part of the Git Essential Training

Subject:
Developer
Software:
Git GitHub
Author:
please wait ...