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:
Checking your Git repository status
Type the following at the prompt to check your Git repository’s 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: