How do I make my first git commit?

Started using git to backup for the code on my website, here’s how I made my first commit =]

In Terminal, navigate to your website directory.

cd /your/directory/here

Once you’re there…

git init
git add .

Make your first commit and label it with a note on what you’re committing.

git commit -m "My First Commit"

The -m is for message, make sure there is no space between the dash and the letter “m”.

If you botch it up, go to your web directory and delete the .git folder – if you don’t see one it’s because it’s hidden you’ll have to turn on hidden folders, like this.

Back to Blog