Commit a Git Repository

Following my last git post, in this post, I will show you how to add files to a git repository and commit the changes.

To check the previous article, please visit the following post.

Add Files

The first step is adding files to my repository, and in my case, I am using VS Code to add files.

Run Add command

After I added the files, I will run the git command below which will start tracking the new file.

git add .

Commit

In the final step I will commit the change using the commit command and add a message using the m switch.

git commit -m "First commit"

Notes:

You might need to run the following two command to configure your name and email.

Git config --global user.email "Email"
Git config --global user.name "Your name"

To specific files to the repository, you can use the following command

git add run.ps1

You can also add multiple files using

git add run.ps1 run2.ps1

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.