27.4 C
HomeprogrammingBasic Git Commands

Basic Git Commands

In this topic, you will get familiar with some basic Git commands. At the end of this topic, you will be able to

1) set up a folder as a Git repository.

2) Perform basics git operations on your Git repository.

Basic Git Commands

1) At a convenient location on your computer, create a folder named git-test.

2) Open this git-test folder in your favorite editor.

3) Create an index.html file and add some code.

Initializing the folder as a Git repository

1) Go to the git-test folder in your cmd window/terminal and type the following at  the prompt to initialize the folder as a Git repository:

git init

Checking your Git repository status

Type the following at the prompt to check your Git repository’s status:

git status

Adding files to the staging area

To add files to the staging area of your Git repository, type:

git add .

Committing to the Git repository

To commit the current staging area to your Git repository, type:

git commit -m "first commit"

Checking the log of Git commits

To check the log of the commits to your Git repository, type

git log --oneline

Resetting the Git repository

To discard the effect of the previous operation and restore index.html, type:

git reset HEAD index.html



  1. Good day! I know this is kinda off topic but I was wondering
    if you knew where I could locate a captcha plugin for my comment form?
    I’m using the same blog platform as yours and I’m having problems finding one?
    Thanks a lot!


Please enter your comment!
Please enter your name here

- Advertisment -spot_img

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Most Popular