27.4 C
Gujarat
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

RELATED ARTICLES

2 COMMENTS

  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!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

15,000FansLike
5,000FollowersFollow
535FollowersFollow
- Advertisment -spot_img

Subscribe to our newsletter

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

Most Popular