Git and GitHub

Git and GitHub

What is Git ?

Git is a version control tool or you can say it is a software which helps in controlling the version of our Application , It can be a web application or a software application. It track changes we made in our application within the local system. It means we have to work only on one system to keep track of change and work on that project.

How to download git for windows.

Just Visit Official Website of git and their is a download option on Homepage, you can download it from their.


What is GitHub ?

GitHub is a cloud based service on version controlling. we can store our code on cloud instead of storing it on local system. It also provide collaboration feature so that one more than one developer can work on same project at same time without interrupting each other. It keeps the of track of change whatever we made in our project.

How to setup gitHub with our local System

step1

Install the git on your local system Click To Download Git.

step2

Create a new repository on GitHub website. If you don't have any account, Go on GitHub and create an account and than create a new repo. Your screen after that looks like :

1.png

step3

Now you need to configure your local system with your GitHub account. open your folder in cmd / terminal write the below command

git config --global user.name "Your Name"

now paste another command

git config --global user.email your_email

Before putting another command you need to get access token from your github profile.

steps to get access token is :

GitHub Profile > settings > developer settings > personal access token > generate new token

Now you have have your access token. Make sure you have copied that access token.

Now put one more command that is :

git config --global user.password your_access_token

Step 4

open your cmd and make sure you have copied your repository URL which we have created in starting and write the below command

git clone you_repo_url

Step 5

Do task whatever you want to do. You want to create file , you can create.

Step 6

Initialize it as a git repo. Write git init in terminal or cmd

git init

Now paste below command to check the status of file

git status

Step 7

If you want to push the file of code from local system to GitHub. First you need to add them in staging area using below command

//To add all changed file in staging area
git add .

//if you want to add only a particular file in staging area 
git add file_name

Step 8

Now you need to commit your change. Its like a snapshot. It gives you an commit id liken in future if you code breaks and you want to move on that stage on which you are right. You can do that thing by using your commit id. command to commit is :

git commit -m "Your Custom Message"
// -m short form of message

Step 9

Now you have to add the path of your repo by using your repo url.

command for that is :

git remote add origin your_repo_url

Step 10

Finally now you can push your code you GitHub using below command.

git push -u origin master/main