All about Git and Github

All about Git and Github

-What is Git.

Git is a version control system that is used to keep track of who changes the code and when. It also displays the code's versions and history.

Ex- Git, Darks and bazar etc.

-What is Version Control System.

It is software that enables us to make changes to the repository and gives us access to code history tracking so that, in the future, we can easily recall our previous source code.

-What is Github.

It is a repository. It is used for storing and maintaining the source code.

Ex- Github, Gitlab and BitBucket etc.

Some popular git hoisting repository services

Gitlab, Github, BitBucket and Perstoke etc.

Three types of version control systems

Local Version Control System(LVCS)-

It is used for made the tracking of the source code and for retrieving back the source code for as per the the specifc version.

Centralised Version Control System(CVCS)-

It is also made for tracking the source code, and developers can also make changes here. All the files here are generally stored on the remote server, which is the only one that Cvcs has.

Distributed Version Control System(DVCS)-

It is also made for the same purpose like distributed version system but in this version control system. It does not have only one single server present, but it also has a local repository. If incase the data of remote server would have corrupt then the local remote will be there for the backup purpose.

Benefits of using Git

keeping track of who changes the code and when they make the changes. It also displays the code's versions and history. A developer from anywhere in the world can commit and retrieve the code easily.

How can we initialize a repository in Git?

After giving the git software our username and email, we can initialize the command with git init.

-How can we determine whether git is installed on our system?

by giving the git software the git --version command.

-How to inform git of our username and email.

We should give the git software the git config command when using git for the first time.

Afterwards, we specify "Sanjeev" as the username with the command git config --global.

We specify git config --global user.email "coolviccy123@gmail.com" as the password.

How to add files to the staging area

Git add filename> cmd can be used to add a file, and git add. / git add --a from untracked area to staged area can be used to add all files inside a folder.

– How to remove a file from staging.

The file can be unstaged from the staging area to the developer workspace by giving the command git rm --cached filename> to the git software.

– How we can commit.

Before executing the commit command, we confirm that the file we intend to add to the local repository is present in the staged area.

commit cmd - commit -m "some commit message like why you created the file"

-How can we send changes to the remote repository.

We must first enter the url github.com. The repository name for the project code will then need to be created.

Following that, a few actions must be taken to handle changes in the remote repository.

Step 1-

git branch - main

Step 2-

git remote add origin <url link of created repository>

Step 3-

git push -u origin main

-Difference between clone and pull.

Pull - It is used to fetch all the latest changes made in the working directory of developer.

Clone - It is used to clone the working directory of the developer from remote repository.