Basic Overview on Git & Git Hub

Basic Overview on Git & Git Hub

What’s a version control system?

It is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time.

What’s are different types of version control system?

1-Centralised Version Control System(CVCS)

2-Distributed Version Control System(DVCS)

Centralised Version Control System:

In Centralised version control system, there is a client and a server. Server will be the central repository where entire code will be present and client needs to pull code on their local machine to work on it. So once you get the latest version of the code, you start making your own changes in the code and after that, you simply need to commit those changes straight forward into the master repository. Master repository will have history of all the commits. So everything is centralised in this model. Only one person can make changes in central repository at a time.

Example: Subversion(SVN) or Concurrent Version System(CVS)

Distributed version control system:

In Distributed version control system, instead of one single repository which is the server, here every single developer or client has their own server and they will have a copy of the entire history or version of the code and all of its branches in their local server or machine. Basically, every client or user can work locally and disconnected which is more convenient than centralized source control and that’s why it is called distributed.
Multiple clients/developers can work simultenously on same code.

Example: Git (Written in C), Mercurial (Written in Python) or Bazaar (Written in Python).

What is GIT and GITHUB?

Git is a distributed version control tool that can manage a development project's source code history.It manages multiple versions of source code. It is a tool that Developers install locally on their computers.

GitHub is a cloud based platform built around the Git tool. It is an online service that stores code pushed to it from computers running the Git tool.

What is the difference between GIT and GIT HUB?

GITGITHUB
Git is an open-source tool developers install locally to manage source code.GitHub is an online service to which developers who use Git can connect and upload or download resources.
Maintained by Linux FoundationPurchased by Microsoft in 2018
First released in 2005Company launched in 2008
Installed LocallyHosted in cloud
Open sourceIncludes a free tier and pay-for-use tiers

Version Control with GIT

GIT Basics:

  • git init initialises a brand new Git repository and begins tracking an existing directory.

  • git clone creates a local copy of a project that already exists remotely. The clone includes all the project’s files, history, and branches.

  • git add stages a change. Git tracks changes to a developer’s code base, but it’s necessary to stage and take a snapshot of the changes to include them in the project’s history.

  • git commit saves the snapshot to the project history and completes the change-tracking process. In short, a commit functions like taking a photo. Anything that’s been staged with git add will become a part of the snapshot with git commit.

  • git status shows the status of changes as untracked, modified, or staged.

  • git branch shows the branches being worked on locally.

  • git merge merges lines of development together. This command is typically used to combine changes made on two distinct branches. For example, a developer would merge when they want to combine changes from a feature branch into the master branch for deployment.

  • git pull updates the local repository with updates from its remote counterpart. Developers use this command if a teammate has made commits to a branch on a remote, and they would like to reflect those changes in their local environment.

  • git push updates the remote repository with any commits made locally to a branch.

Conclusion

Hopefully, this tutorial was good read for you and has given you a basic understanding of GIT and GitHub. The journey is started to dive into Devops world . So, stay tune for more articles.