Some Points About Git Basics

·

2 min read

Git is a version control system that you can keep track of your repository changes in code see what others have done with a particular codebase when then they did this changes all of these changes are done by git. Github is one of of the largest cloud provider in the industry where devs can push their repo collaborate with their teammates in one big project

How to install Git On System to install git you need to download the git bash command line interface and install it accordingly

Some Commands on git

First we need to set our git environment for pushing the code into GitHub or any other git service

     git config --global user.name "user-name"
     git config --global user.email mailttome@gmail.com

these above 2 commands will configure the github environment the username of the git and the email is the email when the user signs up to github

Open your project folder to see whether git is initialized in your project

**git status:-**

The git status command displays the state of the working directory and the staging area. It lets you see which changes have been staged, which haven't, and which files aren't being tracked by Git.

**git init:-**

The git init command creates a new Git repository. It can be used to convert an existing, project to a Git repository or initialize a new, empty repository

**git add:-**

git add Filename will commit only one file to the staging area git add . will add all of the file in the staging area

**git commit -m "first commit"**

git commit with -m indicates that you should provide a message in git commit when a particular user is confirming all the changes that need to be pushed and are in the staging area

**git remote add origin https://github.com/sample/sample.git**

git remote add origin allows to set the origin repo url where the project contents are going to be pushed .Note that repo url can be set to public or private depending on the visibility of the project

  **git push -u origin main**

everything will be pushed to origin master branch in the git repository