DEV Community

Cover image for What is Version Control System?
Rishabh Rathore
Rishabh Rathore

Posted on

What is Version Control System?

A version control system(VCS) is a tool or software that helps to manage different versions of the source code. A source code manager is another name for a version control system.

In other words Version control is a system that carries all the records of file changes or sets of files with respect to time so that we can easily switch to previous versions later.

What is Git?

altText

Git is a type of version control system (VCS) that helps to track the file changes in an easy manner. Git is a free and open-source distributed version control system that has a simple UI design that everyone can understand easily. With the help of Git, we can track small to very large projects with speed and efficiency.
gitWorkflow

  • A repository is a Collection of the Source code or files of the project work, Repositories can exist either in the local environment or in the form of a remote copy on another computer. A repository is made up of commits.
  • Working Directory is the source code or files that you see in your computer's file system. When you open your project files upon a code editor, you're working with files in the Working Directory.
  • Staging Area: A Stage all Changes in the Current directory that stores information about Changes that you commit. You can think of the staging area as a prep table where Git will take the next commit.
  • Branch is a new line of development is created that diverges from the main line of development. This alternative line of development can continue without altering the main line.

How To Setup Git?

To download Git

  1. Go to Git-scm.com
  2. Download Git Acc. to the Operating system
  3. install Git choosing all of the default option

Open GitBash

First Time Git Configuration
# sets up Git with your name
git config --global user.name "<Your-Full-Name>"

# sets up Git with your email
git config --global user.email "<your-email-address>"
Enter fullscreen mode Exit fullscreen mode

Create a new project.Open git bash in project directory then initialize project

git init
Enter fullscreen mode Exit fullscreen mode

The git init command creates a new Git repository or initialize a new, empty repository.

  • touch - used to Create a new file
  • ls - used to list files and directories
  • mkdir - used to create a new directory
  • cd - used to change directories
  • rm - used to remove files and directories

Create A Web Project

  • create an index.html file
touch index.html
Enter fullscreen mode Exit fullscreen mode
  • create a javaScript file
touch main.html
Enter fullscreen mode Exit fullscreen mode
  • create a style.css file
touch style.css
Enter fullscreen mode Exit fullscreen mode

github

git status
Enter fullscreen mode Exit fullscreen mode

gitcommits

  • git status command displays the state of the working directory and the staging area.
git add .
Enter fullscreen mode Exit fullscreen mode
  • git add command adds a file to the Git staging area.
git commit - m "initial commit"
Enter fullscreen mode Exit fullscreen mode
  • git commit -m Used to Save Your changes in local repository.

some Important git Commands

gitcommands

Top comments (6)

Collapse
 
nyctonio profile image
Ritesh Kumar

Great post nicely explained the basics ๐Ÿฅฐ.

Collapse
 
rishabh055 profile image
Rishabh Rathore

Thankyou!! Buddy

Collapse
 
geeky01adarsh profile image
Adarsh Navneet Sinha

Quite informative!!!

Collapse
 
rishabh055 profile image
Rishabh Rathore

I'm Glad to hear this๐Ÿ˜‰

Collapse
 
crackingdemon profile image
crackingdemon

Nice Explanation :)

Collapse
 
rishabh055 profile image
Rishabh Rathore • Edited

Thankyou!! Brother