Your First Commit

What is a commit?

A commit allows you to take snapshot of all the changes and modifications that you have done at a certain point in time and store them in a tree.

How to make a commit

You can make a commit with the command git commit. Keep in mind that there are a few things you have to do before you can make the actual commit.

The first time you are using git, you'll have to add an email and a name. Once you have done this, it will not be asked again.

Adding a message to your commit

You can add a commit message to your commit using the -m flag.

The first commit you make should always be called initial commit.

Example

git commit -m "initial commit"

The above code is the initial commit.

`git commit -m "added interactive buttons"

The above code is adding a feature commit.

Committing untracked files

Untracked files are the files you have not yet added to your staging area. If you want to commit this file anyway, you can use the git commit -a -m command and flags.

Example

git commit -a -m "initial commit"

The above code is the initial commit with possible untracked files.

Looking at previous commits

If you want to look back to see your history of changes, you can log your commits. This is done with the git log command.

It is possible that there are quite a lot of commits. Since they are normally shown in about 5 lines each commit, you can add the flag --oneline to the command, which will collapse all commits in to one line per commit.